From c945e80618c95b9b388d93587d8f3479c935c79b Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 23 Jan 2020 10:20:34 -0700 Subject: [PATCH] Type grooming --- core/src/snapshot_packager_service.rs | 31 ++++++++++++++++----------- core/tests/bank_forks.rs | 5 ++--- ledger-tool/src/main.rs | 4 +--- ledger/src/snapshot_package.rs | 10 ++++----- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/core/src/snapshot_packager_service.rs b/core/src/snapshot_packager_service.rs index 0e14434ba0..3dedae4510 100644 --- a/core/src/snapshot_packager_service.rs +++ b/core/src/snapshot_packager_service.rs @@ -1,19 +1,24 @@ use crate::result::{Error, Result}; use bincode::serialize_into; -use solana_ledger::snapshot_package::{SnapshotPackage, SnapshotPackageReceiver}; -use solana_ledger::snapshot_utils::{self, TAR_ACCOUNTS_DIR, TAR_SNAPSHOTS_DIR, TAR_VERSION_FILE}; +use solana_ledger::{ + snapshot_package::{SnapshotPackage, SnapshotPackageReceiver}, + snapshot_utils::{self, TAR_ACCOUNTS_DIR, TAR_SNAPSHOTS_DIR, TAR_VERSION_FILE}, +}; use solana_measure::measure::Measure; use solana_metrics::datapoint_info; use solana_runtime::status_cache::SlotDelta; -use solana_sdk::transaction::Result as TransactionResult; -use std::fs; -use std::fs::File; -use std::io::{BufWriter, Error as IOError, ErrorKind}; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::mpsc::RecvTimeoutError; -use std::sync::Arc; -use std::thread::{self, Builder, JoinHandle}; -use std::time::Duration; +use solana_sdk::transaction; +use std::{ + fs::{self, File}, + io::{BufWriter, Error as IOError, ErrorKind}, + sync::{ + atomic::{AtomicBool, Ordering}, + mpsc::RecvTimeoutError, + Arc, + }, + thread::{self, Builder, JoinHandle}, + time::Duration, +}; use symlink; use tempfile::TempDir; @@ -169,7 +174,7 @@ impl SnapshotPackagerService { } fn serialize_status_cache( - slot_deltas: &[SlotDelta>], + slot_deltas: &[SlotDelta>], snapshot_links: &TempDir, ) -> Result<()> { // 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 // This is needed since the status_cache is added by the packager and is not collected from // the source dir for snapshots - let slot_deltas: Vec>> = vec![]; + let slot_deltas: Vec>> = vec![]; let dummy_status_cache = File::create(snapshots_dir.join("status_cache")).unwrap(); let mut status_cache_stream = BufWriter::new(dummy_status_cache); serialize_into(&mut status_cache_stream, &slot_deltas).unwrap(); diff --git a/core/tests/bank_forks.rs b/core/tests/bank_forks.rs index 05ecd54ae6..6cf849cbb0 100644 --- a/core/tests/bank_forks.rs +++ b/core/tests/bank_forks.rs @@ -22,8 +22,7 @@ mod tests { hash::hashv, pubkey::Pubkey, signature::{Keypair, KeypairUtil}, - system_transaction, - transaction::Result as TransactionResult, + system_transaction, transaction, }; use std::{ fs, @@ -318,7 +317,7 @@ mod tests { // 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 // the source dir for snapshots - let slot_deltas: Vec>> = vec![]; + let slot_deltas: Vec>> = vec![]; let dummy_status_cache = File::create(saved_snapshots_dir.path().join("status_cache")).unwrap(); let mut status_cache_stream = BufWriter::new(dummy_status_cache); diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 29acbf0966..6fb5e763ae 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -3,13 +3,11 @@ use clap::{ }; use histogram; use serde_json::json; -use solana_ledger::blockstore_db::Database; use solana_ledger::{ bank_forks::{BankForks, SnapshotConfig}, bank_forks_utils, blockstore::Blockstore, - blockstore_db, - blockstore_db::Column, + blockstore_db::{self, Column, Database}, blockstore_processor, rooted_slot_iterator::RootedSlotIterator, }; diff --git a/ledger/src/snapshot_package.rs b/ledger/src/snapshot_package.rs index 212393f120..3c1598d757 100644 --- a/ledger/src/snapshot_package.rs +++ b/ledger/src/snapshot_package.rs @@ -1,6 +1,6 @@ use solana_runtime::accounts_db::AccountStorageEntry; 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::sync::mpsc::{Receiver, SendError, Sender}; use std::sync::Arc; @@ -12,8 +12,8 @@ pub type SnapshotPackageSendError = SendError; #[derive(Debug)] pub struct SnapshotPackage { - pub root: u64, - pub slot_deltas: Vec>>, + pub root: Slot, + pub slot_deltas: Vec>>, pub snapshot_links: TempDir, pub storage_entries: Vec>, pub tar_output_file: PathBuf, @@ -21,8 +21,8 @@ pub struct SnapshotPackage { impl SnapshotPackage { pub fn new( - root: u64, - slot_deltas: Vec>>, + root: Slot, + slot_deltas: Vec>>, snapshot_links: TempDir, storage_entries: Vec>, tar_output_file: PathBuf,