Snapshot Packaging Service (#5262)

* Snapshot serialization and packaging
This commit is contained in:
carllin
2019-07-31 17:58:10 -07:00
committed by GitHub
parent 937f9ad049
commit 6cb2040a1b
18 changed files with 990 additions and 274 deletions

View File

@@ -3,6 +3,7 @@
//! on behalf of the caller, and a low-level API for when they have
//! already been signed and verified.
use crate::accounts::Accounts;
use crate::accounts_db::AccountStorageEntry;
use crate::accounts_db::{
AppendVecId, ErrorCounters, InstructionAccounts, InstructionCredits, InstructionLoaders,
};
@@ -83,6 +84,15 @@ impl BankRc {
self.accounts.update_from_stream(stream)
}
pub fn get_storage_entries(&self) -> Vec<Arc<AccountStorageEntry>> {
let r_storage = self.accounts.accounts_db.storage.read().unwrap();
r_storage
.0
.values()
.flat_map(|fork_store| fork_store.values().cloned())
.collect()
}
fn get_io_error(error: &str) -> std::io::Error {
warn!("BankRc error: {:?}", error);
std::io::Error::new(std::io::ErrorKind::Other, error)
@@ -167,6 +177,10 @@ impl StatusCacheRc {
let sc = status_cache_rc.status_cache.write().unwrap();
self.status_cache.write().unwrap().append(&sc);
}
pub fn purge_roots(&self) {
self.status_cache.write().unwrap().purge_roots();
}
}
/// Manager for the state of all accounts and programs after processing its entries.