move AccountInfo to its own file (#21784)
This commit is contained in:
committed by
GitHub
parent
c5c699a918
commit
ef7f49a21d
@ -5,7 +5,7 @@ extern crate test;
|
|||||||
use {
|
use {
|
||||||
rand::{thread_rng, Rng},
|
rand::{thread_rng, Rng},
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
accounts_db::AccountInfo,
|
account_info::AccountInfo,
|
||||||
accounts_index::{
|
accounts_index::{
|
||||||
AccountSecondaryIndexes, AccountsIndex, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS,
|
AccountSecondaryIndexes, AccountsIndex, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS,
|
||||||
},
|
},
|
||||||
|
24
runtime/src/account_info.rs
Normal file
24
runtime/src/account_info.rs
Normal file
@ -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 std::{thread::sleep, time::Duration};
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
|
account_info::AccountInfo,
|
||||||
accounts_background_service::{DroppedSlotsSender, SendDroppedBankCallback},
|
accounts_background_service::{DroppedSlotsSender, SendDroppedBankCallback},
|
||||||
accounts_cache::{AccountsCache, CachedAccount, SlotCache},
|
accounts_cache::{AccountsCache, CachedAccount, SlotCache},
|
||||||
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass},
|
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 {
|
impl IsCached for AccountInfo {
|
||||||
fn is_cached(&self) -> bool {
|
fn is_cached(&self) -> bool {
|
||||||
self.store_id == CACHE_VIRTUAL_STORAGE_ID
|
self.store_id == CACHE_VIRTUAL_STORAGE_ID
|
||||||
@ -327,12 +312,6 @@ impl IsCached for AccountInfo {
|
|||||||
|
|
||||||
impl IndexValue for AccountInfo {}
|
impl IndexValue for AccountInfo {}
|
||||||
|
|
||||||
impl ZeroLamport for AccountInfo {
|
|
||||||
fn is_zero_lamport(&self) -> bool {
|
|
||||||
self.lamports == 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ZeroLamport for AccountSharedData {
|
impl ZeroLamport for AccountSharedData {
|
||||||
fn is_zero_lamport(&self) -> bool {
|
fn is_zero_lamport(&self) -> bool {
|
||||||
self.lamports() == 0
|
self.lamports() == 0
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
||||||
#![allow(clippy::integer_arithmetic)]
|
#![allow(clippy::integer_arithmetic)]
|
||||||
|
pub mod account_info;
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod accounts_background_service;
|
pub mod accounts_background_service;
|
||||||
pub mod accounts_cache;
|
pub mod accounts_cache;
|
||||||
|
Reference in New Issue
Block a user