AcctIdx: remove auto Debug trait (#19905)

This commit is contained in:
Jeff Washington (jwash) 2021-09-15 09:54:16 -05:00 committed by GitHub
parent fb0c590090
commit b467e7fb3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,7 @@
use crate::accounts_index::IndexValue; use crate::accounts_index::IndexValue;
use crate::bucket_map_holder::BucketMapHolder; use crate::bucket_map_holder::BucketMapHolder;
use crate::waitable_condvar::WaitableCondvar; use crate::waitable_condvar::WaitableCondvar;
use std::fmt::Debug;
use std::{ use std::{
sync::{ sync::{
atomic::{AtomicBool, Ordering}, atomic::{AtomicBool, Ordering},
@ -14,7 +15,7 @@ use std::{
// When this instance is dropped, it will drop the bucket map and cleanup // When this instance is dropped, it will drop the bucket map and cleanup
// and it will stop all the background threads and join them. // and it will stop all the background threads and join them.
#[derive(Debug, Default)] #[derive(Default)]
pub struct AccountsIndexStorage<T: IndexValue> { pub struct AccountsIndexStorage<T: IndexValue> {
// for managing the bg threads // for managing the bg threads
exit: Arc<AtomicBool>, exit: Arc<AtomicBool>,
@ -25,6 +26,12 @@ pub struct AccountsIndexStorage<T: IndexValue> {
storage: Arc<BucketMapHolder<T>>, storage: Arc<BucketMapHolder<T>>,
} }
impl<T: IndexValue> Debug for AccountsIndexStorage<T> {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
impl<T: IndexValue> Drop for AccountsIndexStorage<T> { impl<T: IndexValue> Drop for AccountsIndexStorage<T> {
fn drop(&mut self) { fn drop(&mut self) {
self.exit.store(true, Ordering::Relaxed); self.exit.store(true, Ordering::Relaxed);

View File

@ -7,12 +7,18 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
// will eventually hold the bucket map // will eventually hold the bucket map
#[derive(Debug, Default)] #[derive(Default)]
pub struct BucketMapHolder<T: IndexValue> { pub struct BucketMapHolder<T: IndexValue> {
pub stats: BucketMapHolderStats, pub stats: BucketMapHolderStats,
_phantom: std::marker::PhantomData<T>, _phantom: std::marker::PhantomData<T>,
} }
impl<T: IndexValue> Debug for BucketMapHolder<T> {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
impl<T: IndexValue> BucketMapHolder<T> { impl<T: IndexValue> BucketMapHolder<T> {
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()

View File

@ -15,7 +15,6 @@ use std::ops::RangeBounds;
type K = Pubkey; type K = Pubkey;
// one instance of this represents one bin of the accounts index. // one instance of this represents one bin of the accounts index.
#[derive(Debug)]
pub struct InMemAccountsIndex<T: IndexValue> { pub struct InMemAccountsIndex<T: IndexValue> {
// backing store // backing store
map_internal: RwLock<HashMap<Pubkey, AccountMapEntry<T>>>, map_internal: RwLock<HashMap<Pubkey, AccountMapEntry<T>>>,
@ -23,6 +22,12 @@ pub struct InMemAccountsIndex<T: IndexValue> {
bin: usize, bin: usize,
} }
impl<T: IndexValue> Debug for InMemAccountsIndex<T> {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
impl<T: IndexValue> InMemAccountsIndex<T> { impl<T: IndexValue> InMemAccountsIndex<T> {
pub fn new(storage: &AccountsIndexStorage<T>, bin: usize) -> Self { pub fn new(storage: &AccountsIndexStorage<T>, bin: usize) -> Self {
Self { Self {