pub struct StoreSimpleSled<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>where
N: NamespaceId + EncodableKnownSize + Decodable,
S: SubspaceId,
PD: PayloadDigest,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD>,{ /* private fields */ }Expand description
A simple, sled-powered Willow data store implementing the willow_data_model::Store trait.
Implementations§
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: NamespaceId + EncodableKnownSize + Decodable + DecodableSync,
S: SubspaceId,
PD: PayloadDigest,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD>,
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: NamespaceId + EncodableKnownSize + Decodable + DecodableSync,
S: SubspaceId,
PD: PayloadDigest,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD>,
Sourcepub fn new(namespace: &N, db: Db) -> Result<Self, NewStoreSimpleSledError>
pub fn new(namespace: &N, db: Db) -> Result<Self, NewStoreSimpleSledError>
Returns an empty StoreSimpleSled, or an error if the database is already found to have data in it.
Sourcepub fn new_with_event_queue_capacity(
namespace: &N,
db: Db,
capacity: usize,
) -> Result<Self, NewStoreSimpleSledError>
pub fn new_with_event_queue_capacity( namespace: &N, db: Db, capacity: usize, ) -> Result<Self, NewStoreSimpleSledError>
Returns an empty StoreSimpleSled with a given event queue capacity, or an error if the database is already found to have data in it.
Sourcepub fn from_existing(db: Db) -> Result<Self, ExistingStoreSimpleSledError>
pub fn from_existing(db: Db) -> Result<Self, ExistingStoreSimpleSledError>
Returns a StoreSimpleSled from a sled::Db already containing Willow data, or an error if the data is found to be malformed.
Sourcepub fn from_existing_with_event_queue_capacity(
db: Db,
capacity: usize,
) -> Result<Self, ExistingStoreSimpleSledError>
pub fn from_existing_with_event_queue_capacity( db: Db, capacity: usize, ) -> Result<Self, ExistingStoreSimpleSledError>
Returns a StoreSimpleSled from a sled::Db already containing Willow data with a given event queue capacity, or an error if the data is found to be malformed.
Sourcepub fn clear(&self) -> Result<(), StoreSimpleSledError>
pub fn clear(&self) -> Result<(), StoreSimpleSledError>
Clear all data from the internal sled::Db
Trait Implementations§
Source§impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Store<MCL, MCC, MPL, N, S, PD, AT> for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: NamespaceId + EncodableKnownSize + DecodableSync,
S: SubspaceId + EncodableSync + EncodableKnownSize + Decodable,
PD: PayloadDigest + Encodable + EncodableSync + EncodableKnownSize + Decodable,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD> + TrustedDecodable + Encodable,
S::ErrorReason: Debug,
PD::ErrorReason: Debug,
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Store<MCL, MCC, MPL, N, S, PD, AT> for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: NamespaceId + EncodableKnownSize + DecodableSync,
S: SubspaceId + EncodableSync + EncodableKnownSize + Decodable,
PD: PayloadDigest + Encodable + EncodableSync + EncodableKnownSize + Decodable,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD> + TrustedDecodable + Encodable,
S::ErrorReason: Debug,
PD::ErrorReason: Debug,
type Error = StoreSimpleSledError
Source§fn namespace_id(&self) -> &N
fn namespace_id(&self) -> &N
Returns the namespace which all of this store’s
AuthorisedEntry belong to.Source§async fn ingest_entry(
&self,
authorised_entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>,
prevent_pruning: bool,
origin: EntryOrigin,
) -> Result<EntryIngestionSuccess<MCL, MCC, MPL, N, S, PD, AT>, EntryIngestionError<Self::Error>>
async fn ingest_entry( &self, authorised_entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, prevent_pruning: bool, origin: EntryOrigin, ) -> Result<EntryIngestionSuccess<MCL, MCC, MPL, N, S, PD, AT>, EntryIngestionError<Self::Error>>
Source§async fn append_payload<Producer, PayloadSourceError>(
&self,
subspace: &S,
path: &Path<MCL, MCC, MPL>,
expected_digest: Option<PD>,
payload_source: &mut Producer,
) -> Result<PayloadAppendSuccess, PayloadAppendError<PayloadSourceError, Self::Error>>where
Producer: BulkProducer<Item = u8, Error = PayloadSourceError>,
async fn append_payload<Producer, PayloadSourceError>(
&self,
subspace: &S,
path: &Path<MCL, MCC, MPL>,
expected_digest: Option<PD>,
payload_source: &mut Producer,
) -> Result<PayloadAppendSuccess, PayloadAppendError<PayloadSourceError, Self::Error>>where
Producer: BulkProducer<Item = u8, Error = PayloadSourceError>,
Attempts to append part of a payload for an entry at a given SubspaceId-Path-pair. Read more
Source§async fn forget_entry(
&self,
subspace_id: &S,
path: &Path<MCL, MCC, MPL>,
expected_digest: Option<PD>,
) -> Result<(), ForgetEntryError<Self::Error>>
async fn forget_entry( &self, subspace_id: &S, path: &Path<MCL, MCC, MPL>, expected_digest: Option<PD>, ) -> Result<(), ForgetEntryError<Self::Error>>
Locally forgets an entry with a given
Path and subspace id, returning the forgotten entry, or an error if no entry with that path and subspace ID are held by this store. If an expected_digest is supplied and the entry turns out to not have that digest, then this method does nothing and reports an ForgetEntryError::WrongEntry error. Read moreSource§async fn forget_area(
&self,
area: &Area<MCL, MCC, MPL, S>,
protected: Option<&Area<MCL, MCC, MPL, S>>,
) -> Result<usize, Self::Error>
async fn forget_area( &self, area: &Area<MCL, MCC, MPL, S>, protected: Option<&Area<MCL, MCC, MPL, S>>, ) -> Result<usize, Self::Error>
Locally forgets all
AuthorisedEntry included by a given crate::grouping::Area, returning the number of forgotten entries. Read moreSource§async fn forget_payload(
&self,
subspace_id: &S,
path: &Path<MCL, MCC, MPL>,
expected_digest: Option<PD>,
) -> Result<(), ForgetPayloadError<Self::Error>>
async fn forget_payload( &self, subspace_id: &S, path: &Path<MCL, MCC, MPL>, expected_digest: Option<PD>, ) -> Result<(), ForgetPayloadError<Self::Error>>
Locally forgets the corresponding payload of the entry with a given path and subspace, panics if no entry with that path and subspace ID is held by this store. If an
expected_digest is supplied and the entry turns out to not have that digest, then this method does nothing and reports a ForgetPayloadError::WrongEntry error. Read moreSource§async fn forget_area_payloads(
&self,
area: &Area<MCL, MCC, MPL, S>,
protected: Option<&Area<MCL, MCC, MPL, S>>,
) -> Result<usize, Self::Error>
async fn forget_area_payloads( &self, area: &Area<MCL, MCC, MPL, S>, protected: Option<&Area<MCL, MCC, MPL, S>>, ) -> Result<usize, Self::Error>
Locally forgets all payloads with corresponding [‘AuthorisedEntry’] included by a given
crate::grouping::Area, returning a count of forgotten payloads. Payloads corresponding to entries outside of the given area param will be be prevented from being forgotten. Read moreSource§async fn payload(
&self,
subspace: &S,
path: &Path<MCL, MCC, MPL>,
expected_digest: Option<PD>,
) -> Result<Option<impl BulkProducer<Item = u8, Final = (), Error = Self::Error>>, PayloadError<Self::Error>>
async fn payload( &self, subspace: &S, path: &Path<MCL, MCC, MPL>, expected_digest: Option<PD>, ) -> Result<Option<impl BulkProducer<Item = u8, Final = (), Error = Self::Error>>, PayloadError<Self::Error>>
Returns a
ufotofu::Producer of bytes for the payload corresponding to the given subspace id and path. If an expected_digest is supplied and the entry turns out to not have that digest, then this method does nothing and reports a PayloadError::WrongEntry error.Source§async fn entry(
&self,
subspace_id: &S,
path: &Path<MCL, MCC, MPL>,
ignore: QueryIgnoreParams,
) -> Result<Option<LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>, Self::Error>
async fn entry( &self, subspace_id: &S, path: &Path<MCL, MCC, MPL>, ignore: QueryIgnoreParams, ) -> Result<Option<LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>, Self::Error>
Source§async fn query_area(
&self,
area: &Area<MCL, MCC, MPL, S>,
ignore: QueryIgnoreParams,
) -> Result<impl Producer<Item = LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, Final = ()>, Self::Error>
async fn query_area( &self, area: &Area<MCL, MCC, MPL, S>, ignore: QueryIgnoreParams, ) -> Result<impl Producer<Item = LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, Final = ()>, Self::Error>
Queries which entries are included by an
Area, returning a producer of LengthyAuthorisedEntry produced in an arbitrary order decided by the store implementation.Source§async fn subscribe_area(
&self,
area: &Area<MCL, MCC, MPL, S>,
ignore: QueryIgnoreParams,
) -> impl Producer<Item = StoreEvent<MCL, MCC, MPL, N, S, PD, AT>, Final = (), Error = Self::Error>
async fn subscribe_area( &self, area: &Area<MCL, MCC, MPL, S>, ignore: QueryIgnoreParams, ) -> impl Producer<Item = StoreEvent<MCL, MCC, MPL, N, S, PD, AT>, Final = (), Error = Self::Error>
Subscribes to events concerning entries included by an
crate::grouping::Area, returning a producer of StoreEvents which occurred since the moment of calling this function.Auto Trait Implementations§
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Freeze for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: Freeze,
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !RefUnwindSafe for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !Send for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !Sync for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Unpin for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>where
N: Unpin,
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !UnwindSafe for StoreSimpleSled<MCL, MCC, MPL, N, S, PD, AT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more