Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move Ancestors to its own module #17316

Merged
merged 1 commit into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion accounts-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use rayon::prelude::*;
use solana_measure::measure::Measure;
use solana_runtime::{
accounts::{create_test_accounts, update_accounts_bench, Accounts},
accounts_index::{AccountSecondaryIndexes, Ancestors},
accounts_index::AccountSecondaryIndexes,
ancestors::Ancestors,
};
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
use std::{env, fs, path::PathBuf};
Expand Down
3 changes: 2 additions & 1 deletion runtime/benches/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use rand::Rng;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use solana_runtime::{
accounts::{create_test_accounts, AccountAddressFilter, Accounts},
accounts_index::{AccountSecondaryIndexes, Ancestors},
accounts_index::AccountSecondaryIndexes,
ancestors::Ancestors,
bank::*,
};
use solana_sdk::{
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::{
accounts_db::{
AccountsDb, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult,
},
accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey},
accounts_index::{AccountSecondaryIndexes, IndexKey},
ancestors::Ancestors,
bank::{
NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult,
},
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ use crate::{
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass},
accounts_index::{
AccountIndexGetResult, AccountSecondaryIndexes, AccountsIndex, AccountsIndexRootsStats,
Ancestors, IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport,
IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport,
},
ancestors::Ancestors,
append_vec::{AppendVec, StoredAccountMeta, StoredMeta, StoredMetaWriteVersion},
contains::Contains,
read_only_accounts_cache::ReadOnlyAccountsCache,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/accounts_index.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{
ancestors::Ancestors,
contains::Contains,
inline_spl_token_v2_0::{self, SPL_TOKEN_ACCOUNT_MINT_OFFSET, SPL_TOKEN_ACCOUNT_OWNER_OFFSET},
secondary_index::*,
Expand All @@ -15,7 +16,7 @@ use solana_sdk::{
use std::{
collections::{
btree_map::{self, BTreeMap},
HashMap, HashSet,
HashSet,
},
ops::{
Bound,
Expand All @@ -32,7 +33,6 @@ pub const ITER_BATCH_SIZE: usize = 1000;

pub type SlotList<T> = Vec<(Slot, T)>;
pub type SlotSlice<'s, T> = &'s [(Slot, T)];
pub type Ancestors = HashMap<Slot, usize>;

pub type RefCount = u64;
pub type AccountMap<K, V> = BTreeMap<K, V>;
Expand Down
4 changes: 4 additions & 0 deletions runtime/src/ancestors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use solana_sdk::clock::Slot;
use std::collections::HashMap;

pub type Ancestors = HashMap<Slot, usize>;
8 changes: 4 additions & 4 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ use crate::{
TransactionLoadResult, TransactionLoaders,
},
accounts_db::{ErrorCounters, SnapshotStorages},
accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey},
accounts_index::{AccountSecondaryIndexes, IndexKey},
ancestors::Ancestors,
blockhash_queue::BlockhashQueue,
builtins::{self, ActivationType},
epoch_stakes::{EpochStakes, NodeVoteAccounts},
Expand Down Expand Up @@ -5161,9 +5162,8 @@ pub(crate) mod tests {
use super::*;
use crate::{
accounts_db::SHRINK_RATIO,
accounts_index::{
AccountIndex, AccountMap, AccountSecondaryIndexes, Ancestors, ITER_BATCH_SIZE,
},
accounts_index::{AccountIndex, AccountMap, AccountSecondaryIndexes, ITER_BATCH_SIZE},
ancestors::Ancestors,
genesis_utils::{
activate_all_features, bootstrap_validator_stake_lamports,
create_genesis_config_with_leader, create_genesis_config_with_vote_accounts,
Expand Down
1 change: 1 addition & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub mod accounts_cache;
pub mod accounts_db;
pub mod accounts_hash;
pub mod accounts_index;
pub mod ancestors;
pub mod append_vec;
pub mod bank;
pub mod bank_client;
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
accounts::Accounts, accounts_index::Ancestors, instruction_recorder::InstructionRecorder,
accounts::Accounts, ancestors::Ancestors, instruction_recorder::InstructionRecorder,
log_collector::LogCollector, native_loader::NativeLoader, rent_collector::RentCollector,
};
use log::*;
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use {
crate::{
accounts::Accounts,
accounts_db::{AccountStorageEntry, AccountsDb, AppendVecId, BankHashInfo},
accounts_index::{AccountSecondaryIndexes, Ancestors},
accounts_index::AccountSecondaryIndexes,
ancestors::Ancestors,
append_vec::{AppendVec, StoredMetaWriteVersion},
bank::{Bank, BankFieldsToDeserialize, BankRc, Builtins},
blockhash_queue::BlockhashQueue,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/status_cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::accounts_index::Ancestors;
use crate::ancestors::Ancestors;

use log::*;
use rand::{thread_rng, Rng};
Expand Down
2 changes: 1 addition & 1 deletion runtime/tests/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rand::{thread_rng, Rng};
use rayon::prelude::*;
use solana_runtime::{
accounts_db::{AccountsDb, LoadHint},
accounts_index::Ancestors,
ancestors::Ancestors,
};
use solana_sdk::genesis_config::ClusterType;
use solana_sdk::{
Expand Down