pub trait Database: Sized + Send {
type Family: Family;
type Op: Send + Sync;
type Journal: Journal<Self::Family, Context = Self::Context, Op = Self::Op>;
type Config: Config<JournalConfig = <Self::Journal as Journal<Self::Family>>::Config>;
type Digest: Digest;
type Context: Storage + Clock + Metrics;
type Hasher: Hasher<Digest = Self::Digest>;
// Required methods
fn from_sync_result(
context: Self::Context,
config: Self::Config,
journal: Self::Journal,
pinned_nodes: Option<Vec<Self::Digest>>,
range: NonEmptyRange<Location<Self::Family>>,
apply_batch_size: NonZeroU64,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send;
fn persist_sync_result(
self,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send;
fn local_pinned_nodes(
context: Self::Context,
config: &Self::Config,
target: &Target<Self::Family, Self::Digest>,
journal: &Self::Journal,
) -> impl Future<Output = Result<Option<Vec<Self::Digest>>, Error<Self::Family>>> + Send;
fn root(&self) -> Self::Digest;
}Required Associated Types§
type Family: Family
type Op: Send + Sync
type Journal: Journal<Self::Family, Context = Self::Context, Op = Self::Op>
type Config: Config<JournalConfig = <Self::Journal as Journal<Self::Family>>::Config>
type Digest: Digest
type Context: Storage + Clock + Metrics
type Hasher: Hasher<Digest = Self::Digest>
Required Methods§
Sourcefn from_sync_result(
context: Self::Context,
config: Self::Config,
journal: Self::Journal,
pinned_nodes: Option<Vec<Self::Digest>>,
range: NonEmptyRange<Location<Self::Family>>,
apply_batch_size: NonZeroU64,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
fn from_sync_result( context: Self::Context, config: Self::Config, journal: Self::Journal, pinned_nodes: Option<Vec<Self::Digest>>, range: NonEmptyRange<Location<Self::Family>>, apply_batch_size: NonZeroU64, ) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
Build a database from the journal and pinned nodes populated by the sync engine.
Sourcefn persist_sync_result(
self,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
fn persist_sync_result( self, ) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
Persist any state that must remain provisional until the engine verifies the rebuilt root.
The engine calls this only after Self::root matches the requested target. Implementations
that persist everything in Self::from_sync_result must explicitly return Ok(self).
Sourcefn local_pinned_nodes(
context: Self::Context,
config: &Self::Config,
target: &Target<Self::Family, Self::Digest>,
journal: &Self::Journal,
) -> impl Future<Output = Result<Option<Vec<Self::Digest>>, Error<Self::Family>>> + Send
fn local_pinned_nodes( context: Self::Context, config: &Self::Config, target: &Target<Self::Family, Self::Digest>, journal: &Self::Journal, ) -> impl Future<Output = Result<Option<Vec<Self::Digest>>, Error<Self::Family>>> + Send
Return locally available pinned nodes for the target, if persisted local state can authenticate them.
Returning Some lets a completed sync journal reuse pinned nodes from an on-disk
database instead of fetching them from peers. Returning None always falls back to
fetching from peers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".