Merge pull request #85 from zcash/caching
Add `CachingShardStore` for batching writes to a backend `ShardStore`
This commit is contained in:
commit
099abbfc40
|
@ -36,4 +36,5 @@ test-dependencies = ["proptest", "assert_matches"]
|
|||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
pprof = { version = "0.9", features = ["criterion", "flamegraph"] } # MSRV 1.56
|
||||
dashmap = ">=5, <5.5.0"
|
||||
inferno = ">=0.11, <0.11.5" # MSRV 1.59
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,7 @@ pub use self::prunable::{
|
|||
IncompleteAt, InsertionError, LocatedPrunableTree, PrunableTree, QueryError, RetentionFlags,
|
||||
};
|
||||
|
||||
pub mod caching;
|
||||
pub mod memory;
|
||||
|
||||
#[cfg(any(bench, test, feature = "test-dependencies"))]
|
||||
|
@ -178,9 +179,11 @@ pub trait ShardStore {
|
|||
F: Fn(&mut Checkpoint) -> Result<(), Self::Error>;
|
||||
|
||||
/// Removes a checkpoint from the data store.
|
||||
///
|
||||
/// If no checkpoint exists with the given ID, this does nothing.
|
||||
fn remove_checkpoint(&mut self, checkpoint_id: &Self::CheckpointId) -> Result<(), Self::Error>;
|
||||
|
||||
/// Removes checkpoints with identifiers greater than or equal to the given identifier
|
||||
/// Removes checkpoints with identifiers greater than or equal to the given identifier.
|
||||
fn truncate_checkpoints(
|
||||
&mut self,
|
||||
checkpoint_id: &Self::CheckpointId,
|
||||
|
@ -364,6 +367,11 @@ impl<
|
|||
}
|
||||
}
|
||||
|
||||
/// Consumes this tree and returns its underlying `ShardStore`.
|
||||
pub fn into_store(self) -> S {
|
||||
self.store
|
||||
}
|
||||
|
||||
/// Returns the root address of the tree.
|
||||
pub fn root_addr() -> Address {
|
||||
Address::from_parts(Level::from(DEPTH), 0)
|
||||
|
|
Loading…
Reference in New Issue