Skip to content

Commit

Permalink
zcash_client_backend: Add further doc comments and revert default fea…
Browse files Browse the repository at this point in the history
…tures
  • Loading branch information
Oscar-Pepper committed Mar 12, 2024
1 parent 3802f4a commit 97611f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 0 additions & 2 deletions zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ tokio = { version = "1.21.0", features = ["rt-multi-thread"] }
time = ">=0.3.22, <0.3.24" # time 0.3.24 has MSRV 1.67

[features]
default = ["unstable", "orchard", "sync"]

## Enables the `tonic` gRPC client bindings for connecting to a `lightwalletd` server.
lightwalletd-tonic = ["dep:tonic"]

Expand Down
11 changes: 9 additions & 2 deletions zcash_client_backend/src/data_api/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,26 @@ pub trait BlockCache: BlockSource + Send + Sync {
/// indicating there are blocks missing from the cache.
fn read(&self, range: &ScanRange) -> Result<Vec<CompactBlock>, Self::Error>;

/// Returns the height of highest block known to the block cache within a specified range.
/// Finds the height of the highest block known to the block cache within a specified range.
/// If `range` is `None`, returns the tip of the entire cache.
/// If no blocks are found in the cache, returns `None`.
///
/// Returns `Ok(Some(BlockHeight))` on success, otherwise returns an error.
/// If no blocks are found in the cache, returns Ok(`None`).
fn get_tip_height(&self, range: Option<&ScanRange>)
-> Result<Option<BlockHeight>, Self::Error>;

/// Inserts a vec of compact blocks into the block cache.
///
/// Returns `Ok(())` on success, otherwise returns an error.
fn insert(&self, compact_blocks: Vec<CompactBlock>) -> Result<(), Self::Error>;

/// Removes all cached blocks above a specified block height.
///
/// Returns `Ok(())` on success, otherwise returns an error.
fn truncate(&self, block_height: BlockHeight) -> Result<(), Self::Error>;

/// Deletes a range of compact blocks from the block cache.
///
/// Returns a `JoinHandle` from a `tokio::spawn` task.
fn delete(&self, range: &ScanRange) -> JoinHandle<Result<(), Self::Error>>;
}
Expand Down

0 comments on commit 97611f1

Please sign in to comment.