Remove bank_slot_from_archive
This commit is contained in:
parent
0d4cb252c4
commit
87b13bef8e
|
@ -429,32 +429,6 @@ pub fn remove_snapshot<P: AsRef<Path>>(slot: Slot, snapshot_path: P) -> Result<(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn bank_slot_from_archive<P: AsRef<Path>>(snapshot_tar: P) -> Result<Slot> {
|
||||
let tempdir = tempfile::TempDir::new()?;
|
||||
untar_snapshot_in(&snapshot_tar, &tempdir)?;
|
||||
let unpacked_snapshots_dir = tempdir.path().join(TAR_SNAPSHOTS_DIR);
|
||||
let local_account_paths = vec![tempdir.path().join("account_dummy")];
|
||||
let unpacked_accounts_dir = tempdir.path().join(TAR_ACCOUNTS_DIR);
|
||||
let snapshot_paths = get_snapshot_paths(&unpacked_snapshots_dir);
|
||||
let last_root_paths = snapshot_paths
|
||||
.last()
|
||||
.ok_or_else(|| get_io_error("No snapshots found in snapshots directory"))?;
|
||||
let bank = deserialize_snapshot_data_file(
|
||||
&last_root_paths.snapshot_file_path,
|
||||
MAX_SNAPSHOT_DATA_FILE_SIZE,
|
||||
|stream| {
|
||||
let bank: Bank = deserialize_from_snapshot(stream.by_ref())?;
|
||||
bank.rc.accounts_from_stream(
|
||||
stream.by_ref(),
|
||||
&local_account_paths,
|
||||
&unpacked_accounts_dir,
|
||||
)?;
|
||||
Ok(bank)
|
||||
},
|
||||
)?;
|
||||
Ok(bank.slot())
|
||||
}
|
||||
|
||||
pub fn bank_from_archive<P: AsRef<Path>>(
|
||||
account_paths: &[PathBuf],
|
||||
snapshot_path: &PathBuf,
|
||||
|
|
Loading…
Reference in New Issue