use AppendVecId instead of usize (#21792)
This commit is contained in:
parent
c5b6ea74ef
commit
825f8bcea4
|
@ -371,7 +371,7 @@ pub type SnapshotStorage = Vec<Arc<AccountStorageEntry>>;
|
||||||
pub type SnapshotStorages = Vec<SnapshotStorage>;
|
pub type SnapshotStorages = Vec<SnapshotStorage>;
|
||||||
|
|
||||||
// Each slot has a set of storage entries.
|
// Each slot has a set of storage entries.
|
||||||
pub(crate) type SlotStores = Arc<RwLock<HashMap<usize, Arc<AccountStorageEntry>>>>;
|
pub(crate) type SlotStores = Arc<RwLock<HashMap<AppendVecId, Arc<AccountStorageEntry>>>>;
|
||||||
|
|
||||||
type AccountSlots = HashMap<Pubkey, HashSet<Slot>>;
|
type AccountSlots = HashMap<Pubkey, HashSet<Slot>>;
|
||||||
type AppendVecOffsets = HashMap<AppendVecId, HashSet<usize>>;
|
type AppendVecOffsets = HashMap<AppendVecId, HashSet<usize>>;
|
||||||
|
@ -654,7 +654,7 @@ pub struct AccountStorageEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccountStorageEntry {
|
impl AccountStorageEntry {
|
||||||
pub fn new(path: &Path, slot: Slot, id: usize, file_size: u64) -> Self {
|
pub fn new(path: &Path, slot: Slot, id: AppendVecId, file_size: u64) -> Self {
|
||||||
let tail = AppendVec::file_name(slot, id);
|
let tail = AppendVec::file_name(slot, id);
|
||||||
let path = Path::new(path).join(tail);
|
let path = Path::new(path).join(tail);
|
||||||
let accounts = AppendVec::new(&path, true, file_size as usize);
|
let accounts = AppendVec::new(&path, true, file_size as usize);
|
||||||
|
@ -706,7 +706,7 @@ impl AccountStorageEntry {
|
||||||
*count_and_status = (count, status);
|
*count_and_status = (count, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn recycle(&self, slot: Slot, id: usize) {
|
pub fn recycle(&self, slot: Slot, id: AppendVecId) {
|
||||||
let mut count_and_status = self.count_and_status.write().unwrap();
|
let mut count_and_status = self.count_and_status.write().unwrap();
|
||||||
self.accounts.reset();
|
self.accounts.reset();
|
||||||
*count_and_status = (0, AccountStorageStatus::Available);
|
*count_and_status = (0, AccountStorageStatus::Available);
|
||||||
|
@ -1843,7 +1843,7 @@ impl AccountsDb {
|
||||||
no_delete
|
no_delete
|
||||||
};
|
};
|
||||||
if no_delete {
|
if no_delete {
|
||||||
let mut pending_store_ids: HashSet<usize> = HashSet::new();
|
let mut pending_store_ids = HashSet::new();
|
||||||
for (_bank_id, account_info) in account_infos {
|
for (_bank_id, account_info) in account_infos {
|
||||||
if !already_counted.contains(&account_info.store_id) {
|
if !already_counted.contains(&account_info.store_id) {
|
||||||
pending_store_ids.insert(account_info.store_id);
|
pending_store_ids.insert(account_info.store_id);
|
||||||
|
@ -3358,7 +3358,7 @@ impl AccountsDb {
|
||||||
fn retry_to_get_account_accessor<'a>(
|
fn retry_to_get_account_accessor<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
mut slot: Slot,
|
mut slot: Slot,
|
||||||
mut store_id: usize,
|
mut store_id: AppendVecId,
|
||||||
mut offset: usize,
|
mut offset: usize,
|
||||||
ancestors: &'a Ancestors,
|
ancestors: &'a Ancestors,
|
||||||
pubkey: &'a Pubkey,
|
pubkey: &'a Pubkey,
|
||||||
|
@ -3696,7 +3696,7 @@ impl AccountsDb {
|
||||||
&'a self,
|
&'a self,
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
pubkey: &'a Pubkey,
|
pubkey: &'a Pubkey,
|
||||||
store_id: usize,
|
store_id: AppendVecId,
|
||||||
offset: usize,
|
offset: usize,
|
||||||
) -> LoadedAccountAccessor<'a> {
|
) -> LoadedAccountAccessor<'a> {
|
||||||
if store_id == CACHE_VIRTUAL_STORAGE_ID {
|
if store_id == CACHE_VIRTUAL_STORAGE_ID {
|
||||||
|
|
|
@ -301,7 +301,7 @@ impl AppendVec {
|
||||||
self.file_size
|
self.file_size
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn file_name(slot: Slot, id: usize) -> String {
|
pub fn file_name(slot: Slot, id: impl std::fmt::Display) -> String {
|
||||||
format!("{}.{}", slot, id)
|
format!("{}.{}", slot, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue