2021-01-07 22:45:42 -08:00
|
|
|
use crate::bank_forks::ArchiveFormat;
|
2020-06-19 06:38:37 +01:00
|
|
|
use crate::snapshot_utils::SnapshotVersion;
|
2020-06-17 09:27:03 -06:00
|
|
|
use crate::{accounts_db::SnapshotStorages, bank::BankSlotDelta};
|
2020-02-10 20:11:37 +09:00
|
|
|
use solana_sdk::clock::Slot;
|
2020-02-20 11:46:13 -08:00
|
|
|
use solana_sdk::hash::Hash;
|
2020-02-18 10:02:29 -07:00
|
|
|
use std::{
|
|
|
|
path::PathBuf,
|
2020-02-21 15:27:55 +09:00
|
|
|
sync::mpsc::{Receiver, SendError, Sender},
|
2020-02-18 10:02:29 -07:00
|
|
|
};
|
2019-08-07 13:12:53 -07:00
|
|
|
use tempfile::TempDir;
|
2019-07-31 17:58:10 -07:00
|
|
|
|
2020-04-16 15:12:20 -07:00
|
|
|
pub type AccountsPackageSender = Sender<AccountsPackage>;
|
|
|
|
pub type AccountsPackageReceiver = Receiver<AccountsPackage>;
|
|
|
|
pub type AccountsPackageSendError = SendError<AccountsPackage>;
|
2019-07-31 17:58:10 -07:00
|
|
|
|
2020-01-23 09:46:30 -07:00
|
|
|
#[derive(Debug)]
|
2020-04-16 15:12:20 -07:00
|
|
|
pub struct AccountsPackage {
|
2021-01-04 13:22:58 -08:00
|
|
|
pub slot: Slot,
|
2020-04-16 15:12:20 -07:00
|
|
|
pub block_height: Slot,
|
2020-02-10 20:11:37 +09:00
|
|
|
pub slot_deltas: Vec<BankSlotDelta>,
|
2019-10-18 15:58:16 -06:00
|
|
|
pub snapshot_links: TempDir,
|
2020-02-21 15:27:55 +09:00
|
|
|
pub storages: SnapshotStorages,
|
2019-10-18 15:58:16 -06:00
|
|
|
pub tar_output_file: PathBuf,
|
2020-02-20 11:46:13 -08:00
|
|
|
pub hash: Hash,
|
2021-01-07 22:45:42 -08:00
|
|
|
pub archive_format: ArchiveFormat,
|
2020-06-19 06:38:37 +01:00
|
|
|
pub snapshot_version: SnapshotVersion,
|
2019-07-31 17:58:10 -07:00
|
|
|
}
|
|
|
|
|
2020-04-16 15:12:20 -07:00
|
|
|
impl AccountsPackage {
|
2019-07-31 17:58:10 -07:00
|
|
|
pub fn new(
|
2021-01-04 13:22:58 -08:00
|
|
|
slot: Slot,
|
2020-04-16 15:12:20 -07:00
|
|
|
block_height: u64,
|
2020-02-10 20:11:37 +09:00
|
|
|
slot_deltas: Vec<BankSlotDelta>,
|
2019-08-07 13:12:53 -07:00
|
|
|
snapshot_links: TempDir,
|
2020-02-21 15:27:55 +09:00
|
|
|
storages: SnapshotStorages,
|
2019-07-31 17:58:10 -07:00
|
|
|
tar_output_file: PathBuf,
|
2020-02-20 11:46:13 -08:00
|
|
|
hash: Hash,
|
2021-01-07 22:45:42 -08:00
|
|
|
archive_format: ArchiveFormat,
|
2020-06-19 06:38:37 +01:00
|
|
|
snapshot_version: SnapshotVersion,
|
2019-07-31 17:58:10 -07:00
|
|
|
) -> Self {
|
|
|
|
Self {
|
2021-01-04 13:22:58 -08:00
|
|
|
slot,
|
2020-04-16 15:12:20 -07:00
|
|
|
block_height,
|
2019-09-25 13:42:19 -07:00
|
|
|
slot_deltas,
|
2019-08-07 13:12:53 -07:00
|
|
|
snapshot_links,
|
2020-02-21 15:27:55 +09:00
|
|
|
storages,
|
2019-07-31 17:58:10 -07:00
|
|
|
tar_output_file,
|
2020-02-20 11:46:13 -08:00
|
|
|
hash,
|
2021-01-07 22:45:42 -08:00
|
|
|
archive_format,
|
2020-06-19 06:38:37 +01:00
|
|
|
snapshot_version,
|
2019-07-31 17:58:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|