pub trait Database: Sized + Send {
type Family: Family;
type Op: Encode + Send;
type Config: Clone;
type Digest: Digest;
type Context: Storage + Clock + Metrics;
type Hasher: Hasher<Digest = Self::Digest>;
// Required methods
fn from_validated_state(
context: Self::Context,
config: Self::Config,
state: ValidatedState<Self::Family, Self::Op, Self::Digest>,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send;
fn inactivity_floor(op: &Self::Op) -> Option<Location<Self::Family>>;
fn root(&self) -> Self::Digest;
fn persist_compact_state(
&self,
) -> impl Future<Output = Result<(), Error<Self::Family>>> + Send;
}Expand description
Database types that can be initialized directly from compact state.
Required Associated Types§
type Family: Family
type Op: Encode + Send
type Config: Clone
type Digest: Digest
type Context: Storage + Clock + Metrics
type Hasher: Hasher<Digest = Self::Digest>
Required Methods§
Sourcefn from_validated_state(
context: Self::Context,
config: Self::Config,
state: ValidatedState<Self::Family, Self::Op, Self::Digest>,
) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
fn from_validated_state( context: Self::Context, config: Self::Config, state: ValidatedState<Self::Family, Self::Op, Self::Digest>, ) -> impl Future<Output = Result<Self, Error<Self::Family>>> + Send
Build a database from authenticated state in memory.
The caller has already validated last_commit_proof and the compact frontier against the
requested target root and passes the derived validation artifacts with the state. This
constructor must not durably persist anything; persistence happens only after the caller
re-checks that Self::root() matches the target root.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".