Type grooming

This commit is contained in:
Michael Vines
2020-01-23 10:20:34 -07:00
parent 0802793d37
commit c945e80618
4 changed files with 26 additions and 24 deletions

View File

@ -1,19 +1,24 @@
use crate::result::{Error, Result}; use crate::result::{Error, Result};
use bincode::serialize_into; use bincode::serialize_into;
use solana_ledger::snapshot_package::{SnapshotPackage, SnapshotPackageReceiver}; use solana_ledger::{
use solana_ledger::snapshot_utils::{self, TAR_ACCOUNTS_DIR, TAR_SNAPSHOTS_DIR, TAR_VERSION_FILE}; snapshot_package::{SnapshotPackage, SnapshotPackageReceiver},
snapshot_utils::{self, TAR_ACCOUNTS_DIR, TAR_SNAPSHOTS_DIR, TAR_VERSION_FILE},
};
use solana_measure::measure::Measure; use solana_measure::measure::Measure;
use solana_metrics::datapoint_info; use solana_metrics::datapoint_info;
use solana_runtime::status_cache::SlotDelta; use solana_runtime::status_cache::SlotDelta;
use solana_sdk::transaction::Result as TransactionResult; use solana_sdk::transaction;
use std::fs; use std::{
use std::fs::File; fs::{self, File},
use std::io::{BufWriter, Error as IOError, ErrorKind}; io::{BufWriter, Error as IOError, ErrorKind},
use std::sync::atomic::{AtomicBool, Ordering}; sync::{
use std::sync::mpsc::RecvTimeoutError; atomic::{AtomicBool, Ordering},
use std::sync::Arc; mpsc::RecvTimeoutError,
use std::thread::{self, Builder, JoinHandle}; Arc,
use std::time::Duration; },
thread::{self, Builder, JoinHandle},
time::Duration,
};
use symlink; use symlink;
use tempfile::TempDir; use tempfile::TempDir;
@ -169,7 +174,7 @@ impl SnapshotPackagerService {
} }
fn serialize_status_cache( fn serialize_status_cache(
slot_deltas: &[SlotDelta<TransactionResult<()>>], slot_deltas: &[SlotDelta<transaction::Result<()>>],
snapshot_links: &TempDir, snapshot_links: &TempDir,
) -> Result<()> { ) -> Result<()> {
// the status cache is stored as snapshot_path/status_cache // the status cache is stored as snapshot_path/status_cache
@ -288,7 +293,7 @@ mod tests {
// before we compare, stick an empty status_cache in this dir so that the package comparision works // before we compare, stick an empty status_cache in this dir so that the package comparision works
// This is needed since the status_cache is added by the packager and is not collected from // This is needed since the status_cache is added by the packager and is not collected from
// the source dir for snapshots // the source dir for snapshots
let slot_deltas: Vec<SlotDelta<TransactionResult<()>>> = vec![]; let slot_deltas: Vec<SlotDelta<transaction::Result<()>>> = vec![];
let dummy_status_cache = File::create(snapshots_dir.join("status_cache")).unwrap(); let dummy_status_cache = File::create(snapshots_dir.join("status_cache")).unwrap();
let mut status_cache_stream = BufWriter::new(dummy_status_cache); let mut status_cache_stream = BufWriter::new(dummy_status_cache);
serialize_into(&mut status_cache_stream, &slot_deltas).unwrap(); serialize_into(&mut status_cache_stream, &slot_deltas).unwrap();

View File

@ -22,8 +22,7 @@ mod tests {
hash::hashv, hash::hashv,
pubkey::Pubkey, pubkey::Pubkey,
signature::{Keypair, KeypairUtil}, signature::{Keypair, KeypairUtil},
system_transaction, system_transaction, transaction,
transaction::Result as TransactionResult,
}; };
use std::{ use std::{
fs, fs,
@ -318,7 +317,7 @@ mod tests {
// before we compare, stick an empty status_cache in this dir so that the package comparision works // before we compare, stick an empty status_cache in this dir so that the package comparision works
// This is needed since the status_cache is added by the packager and is not collected from // This is needed since the status_cache is added by the packager and is not collected from
// the source dir for snapshots // the source dir for snapshots
let slot_deltas: Vec<SlotDelta<TransactionResult<()>>> = vec![]; let slot_deltas: Vec<SlotDelta<transaction::Result<()>>> = vec![];
let dummy_status_cache = let dummy_status_cache =
File::create(saved_snapshots_dir.path().join("status_cache")).unwrap(); File::create(saved_snapshots_dir.path().join("status_cache")).unwrap();
let mut status_cache_stream = BufWriter::new(dummy_status_cache); let mut status_cache_stream = BufWriter::new(dummy_status_cache);

View File

@ -3,13 +3,11 @@ use clap::{
}; };
use histogram; use histogram;
use serde_json::json; use serde_json::json;
use solana_ledger::blockstore_db::Database;
use solana_ledger::{ use solana_ledger::{
bank_forks::{BankForks, SnapshotConfig}, bank_forks::{BankForks, SnapshotConfig},
bank_forks_utils, bank_forks_utils,
blockstore::Blockstore, blockstore::Blockstore,
blockstore_db, blockstore_db::{self, Column, Database},
blockstore_db::Column,
blockstore_processor, blockstore_processor,
rooted_slot_iterator::RootedSlotIterator, rooted_slot_iterator::RootedSlotIterator,
}; };

View File

@ -1,6 +1,6 @@
use solana_runtime::accounts_db::AccountStorageEntry; use solana_runtime::accounts_db::AccountStorageEntry;
use solana_runtime::status_cache::SlotDelta; use solana_runtime::status_cache::SlotDelta;
use solana_sdk::transaction::Result as TransactionResult; use solana_sdk::{clock::Slot, transaction};
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::mpsc::{Receiver, SendError, Sender}; use std::sync::mpsc::{Receiver, SendError, Sender};
use std::sync::Arc; use std::sync::Arc;
@ -12,8 +12,8 @@ pub type SnapshotPackageSendError = SendError<SnapshotPackage>;
#[derive(Debug)] #[derive(Debug)]
pub struct SnapshotPackage { pub struct SnapshotPackage {
pub root: u64, pub root: Slot,
pub slot_deltas: Vec<SlotDelta<TransactionResult<()>>>, pub slot_deltas: Vec<SlotDelta<transaction::Result<()>>>,
pub snapshot_links: TempDir, pub snapshot_links: TempDir,
pub storage_entries: Vec<Arc<AccountStorageEntry>>, pub storage_entries: Vec<Arc<AccountStorageEntry>>,
pub tar_output_file: PathBuf, pub tar_output_file: PathBuf,
@ -21,8 +21,8 @@ pub struct SnapshotPackage {
impl SnapshotPackage { impl SnapshotPackage {
pub fn new( pub fn new(
root: u64, root: Slot,
slot_deltas: Vec<SlotDelta<TransactionResult<()>>>, slot_deltas: Vec<SlotDelta<transaction::Result<()>>>,
snapshot_links: TempDir, snapshot_links: TempDir,
storage_entries: Vec<Arc<AccountStorageEntry>>, storage_entries: Vec<Arc<AccountStorageEntry>>,
tar_output_file: PathBuf, tar_output_file: PathBuf,