Struct StoreSimpleSled

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

type Error = StoreSimpleSledError

Source§

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>>

Attempts to ingest an AuthorisedEntry into the Store. Read more
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>,

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>>

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

async fn flush(&self) -> Result<(), Self::Error>

Forces persistence of all previous mutations
Source§

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>

Returns a LengthyAuthorisedEntry with the given Path and subspace ID, if present.
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>

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>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.