move AccountInfo to its own file (#21784)
This commit is contained in:
parent
c5c699a918
commit
ef7f49a21d
|
@ -5,7 +5,7 @@ extern crate test;
|
|||
use {
|
||||
rand::{thread_rng, Rng},
|
||||
solana_runtime::{
|
||||
accounts_db::AccountInfo,
|
||||
account_info::AccountInfo,
|
||||
accounts_index::{
|
||||
AccountSecondaryIndexes, AccountsIndex, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS,
|
||||
},
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
use crate::{accounts_db::AppendVecId, accounts_index::ZeroLamport};
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Clone, Copy)]
|
||||
pub struct AccountInfo {
|
||||
/// index identifying the append storage
|
||||
pub store_id: AppendVecId,
|
||||
|
||||
/// offset into the storage
|
||||
pub offset: usize,
|
||||
|
||||
/// needed to track shrink candidacy in bytes. Used to update the number
|
||||
/// of alive bytes in an AppendVec as newer slots purge outdated entries
|
||||
pub stored_size: usize,
|
||||
|
||||
/// lamports in the account used when squashing kept for optimization
|
||||
/// purposes to remove accounts with zero balance.
|
||||
pub lamports: u64,
|
||||
}
|
||||
|
||||
impl ZeroLamport for AccountInfo {
|
||||
fn is_zero_lamport(&self) -> bool {
|
||||
self.lamports == 0
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
use std::{thread::sleep, time::Duration};
|
||||
use {
|
||||
crate::{
|
||||
account_info::AccountInfo,
|
||||
accounts_background_service::{DroppedSlotsSender, SendDroppedBankCallback},
|
||||
accounts_cache::{AccountsCache, CachedAccount, SlotCache},
|
||||
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass},
|
||||
|
@ -303,22 +304,6 @@ impl GenerateIndexTimings {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Clone, Copy)]
|
||||
pub struct AccountInfo {
|
||||
/// index identifying the append storage
|
||||
store_id: AppendVecId,
|
||||
|
||||
/// offset into the storage
|
||||
offset: usize,
|
||||
|
||||
/// needed to track shrink candidacy in bytes. Used to update the number
|
||||
/// of alive bytes in an AppendVec as newer slots purge outdated entries
|
||||
stored_size: usize,
|
||||
|
||||
/// lamports in the account used when squashing kept for optimization
|
||||
/// purposes to remove accounts with zero balance.
|
||||
lamports: u64,
|
||||
}
|
||||
impl IsCached for AccountInfo {
|
||||
fn is_cached(&self) -> bool {
|
||||
self.store_id == CACHE_VIRTUAL_STORAGE_ID
|
||||
|
@ -327,12 +312,6 @@ impl IsCached for AccountInfo {
|
|||
|
||||
impl IndexValue for AccountInfo {}
|
||||
|
||||
impl ZeroLamport for AccountInfo {
|
||||
fn is_zero_lamport(&self) -> bool {
|
||||
self.lamports == 0
|
||||
}
|
||||
}
|
||||
|
||||
impl ZeroLamport for AccountSharedData {
|
||||
fn is_zero_lamport(&self) -> bool {
|
||||
self.lamports() == 0
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
pub mod account_info;
|
||||
pub mod accounts;
|
||||
pub mod accounts_background_service;
|
||||
pub mod accounts_cache;
|
||||
|
|
Loading…
Reference in New Issue