Skip to main content

SnapshotBuild

Trait SnapshotBuild 

Source
pub trait SnapshotBuild<F: Family>:
    SnapshotBuildSealed
    + Index<Value = Location<F>>
    + Sized
    + 'static {
    type Concurrency: Copy + Send + 'static;

    // Provided method
    async fn build_snapshot<E, C>(
        &mut self,
        _context: E,
        inactivity_floor_loc: Location<F>,
        log: &Arc<C>,
        _init_concurrency: Self::Concurrency,
        init_buffer: NonZeroUsize,
        cache_size: Option<NonZeroUsize>,
    ) -> Result<(usize, BitMap), Error<F>>
       where E: Spawner,
             C: Contiguous<Item: Operation<F>> + 'static { ... }
}
Expand description

Builds a database’s snapshot index from the operations log.

Generic over the Index type so each index controls how it builds: serially with the default method body, or split across parallel workers with an override.

Sealed: only in-crate index types implement this, so internal invariants (e.g. builds must drop every clone of the shared log before returning) are enforced by the implementations rather than the public contract.

Required Associated Types§

Source

type Concurrency: Copy + Send + 'static

The concurrency configuration the build consumes. Index types that always build serially declare (), so a setting they cannot use is unrepresentable.

Provided Methods§

Source

async fn build_snapshot<E, C>( &mut self, _context: E, inactivity_floor_loc: Location<F>, log: &Arc<C>, _init_concurrency: Self::Concurrency, init_buffer: NonZeroUsize, cache_size: Option<NonZeroUsize>, ) -> Result<(usize, BitMap), Error<F>>
where E: Spawner, C: Contiguous<Item: Operation<F>> + 'static,

Replay log from inactivity_floor_loc, populating self. Returns the number of active keys and the activity status of every replayed location, in location order: a location’s bit is set iff it holds the current operation of an active key or is the last commit.

init_buffer sizes the replay read buffer (in bytes), and cache_size bounds each build’s (location -> key) cache (None disables it).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<F: Family, T: Translator, const P: usize> SnapshotBuild<F> for commonware_storage::index::partitioned::unordered::Index<T, Location<F>, P>

Source§

impl<F: Family, T: Translator, const P: usize> SnapshotBuild<F> for commonware_storage::index::partitioned::ordered::Index<T, Location<F>, P>

Source§

impl<F: Family, T: Translator> SnapshotBuild<F> for commonware_storage::index::unordered::Index<T, Location<F>>

Source§

impl<F: Family, T: Translator> SnapshotBuild<F> for commonware_storage::index::ordered::Index<T, Location<F>>