Skip to content

Commit

Permalink
Add #[derive(Debug)] in a few missing places (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuris authored Aug 15, 2023
1 parent 89204f1 commit e257247
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions firewood/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct DbParams {
root_hash_file_nbit: u64,
}

#[derive(Clone)]
#[derive(Clone, Debug)]
/// Necessary linear space instances bundled for a `CompactSpace`.
struct SubUniverse<T> {
meta: T,
Expand Down Expand Up @@ -221,7 +221,7 @@ impl Storable for DbHeader {
}
}

#[derive(Clone)]
#[derive(Clone, Debug)]
/// Necessary linear space instances bundled for the state of the entire DB.
struct Universe<T> {
merkle: SubUniverse<T>,
Expand Down Expand Up @@ -273,6 +273,7 @@ impl<T: MemStoreR + 'static> Universe<Arc<T>> {
}

/// Some readable version of the DB.
#[derive(Debug)]
pub struct DbRev<S> {
header: shale::Obj<DbHeader>,
merkle: Merkle<S>,
Expand Down Expand Up @@ -341,6 +342,7 @@ impl<S: ShaleStore<Node> + Send + Sync> DbRev<S> {
}
}

#[derive(Debug)]
struct DbInner {
disk_requester: DiskBufferRequester,
disk_thread: Option<JoinHandle<()>>,
Expand All @@ -357,6 +359,7 @@ impl Drop for DbInner {
}
}

#[derive(Debug)]
pub struct DbRevInner<T> {
inner: VecDeque<Universe<StoreRevShared>>,
root_hashes: VecDeque<TrieHash>,
Expand All @@ -366,6 +369,7 @@ pub struct DbRevInner<T> {
}

/// Firewood database handle.
#[derive(Debug)]
pub struct Db<S> {
inner: Arc<RwLock<DbInner>>,
revisions: Arc<Mutex<DbRevInner<S>>>,
Expand Down
1 change: 1 addition & 0 deletions firewood/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ macro_rules! write_node {
};
}

#[derive(Debug)]
pub struct Merkle<S> {
store: Box<S>,
}
Expand Down
3 changes: 3 additions & 0 deletions shale/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pub struct CompactSpaceHeader {
alloc_addr: ObjPtr<CompactDescriptor>,
}

#[derive(Debug)]
struct CompactSpaceHeaderSliced {
meta_space_tail: Obj<U64Field>,
compact_space_tail: Obj<U64Field>,
Expand Down Expand Up @@ -293,6 +294,7 @@ impl std::ops::DerefMut for U64Field {
}
}

#[derive(Debug)]
struct CompactSpaceInner<T: Send + Sync, M> {
meta_space: Arc<M>,
compact_space: Arc<M>,
Expand Down Expand Up @@ -562,6 +564,7 @@ impl<T: Storable + Send + Sync, M: CachedStore> CompactSpaceInner<T, M> {
}
}

#[derive(Debug)]
pub struct CompactSpace<T: Send + Sync, M> {
inner: RwLock<CompactSpaceInner<T, M>>,
}
Expand Down
6 changes: 4 additions & 2 deletions shale/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,16 @@ impl<T> Storable for ObjPtr<T> {
}
}

pub struct ObjCacheInner<T: ?Sized + Send + Sync> {
#[derive(Debug)]
pub struct ObjCacheInner<T: Send + Sync> {
cached: lru::LruCache<ObjPtr<T>, Obj<T>>,
pinned: HashMap<ObjPtr<T>, bool>,
dirty: HashSet<ObjPtr<T>>,
}

/// [ObjRef] pool that is used by [ShaleStore] implementation to construct [ObjRef]s.
pub struct ObjCache<T: ?Sized + Send + Sync>(Arc<RwLock<ObjCacheInner<T>>>);
#[derive(Debug)]
pub struct ObjCache<T: Send + Sync>(Arc<RwLock<ObjCacheInner<T>>>);

impl<T: Send + Sync> ObjCache<T> {
pub fn new(capacity: usize) -> Self {
Expand Down

0 comments on commit e257247

Please sign in to comment.