Skip to main content

TestCache

Trait TestCache 

Source
pub trait TestCache {
    type BsError: Debug;
    type BlockSource: BlockSource<Error = Self::BsError>;
    type InsertResult: CacheInsertionResult;

    // Required methods
    fn block_source(&self) -> &Self::BlockSource;
    fn insert(&mut self, cb: &CompactBlock) -> Self::InsertResult;
    fn truncate_to_height(&mut self, height: BlockHeight);
}
Available on crate features test-dependencies only.
Expand description

Trait used by tests that require a block cache.

Required Associated Types§

Required Methods§

Source

fn block_source(&self) -> &Self::BlockSource

Exposes the block cache as a BlockSource.

Source

fn insert(&mut self, cb: &CompactBlock) -> Self::InsertResult

Inserts a CompactBlock into the cache DB.

Source

fn truncate_to_height(&mut self, height: BlockHeight)

Deletes block data from the cache, retaining blocks at heights less than or equal to the specified height.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§