MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> { /* private fields */ }
Expand description

A non-persistent, in-memory Willow store implementation.

Implementations§

Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

Source

pub fn new() -> Self

Creates a new, empty Willow store.

Trait Implementations§

Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Clone for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N: Debug, S: Debug, PD: Debug, AT: Debug> Debug for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Store<MCL, MCC, MPL, N, S, PD, AT> for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>
where PD: Clone + Ord, N: Clone + Ord, S: Clone + Ord, AT: Clone,

Source§

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

A no-op, because the store is not persistent.

Source§

type InternalError = Infallible

The type of errors the store implementation might yield on any operation.
Source§

async fn create_entry<Data, P, H>( &mut self, data: &Data, payload_producer: P, payload_length: u64, ingredients: &AT::Ingredients, ) -> Result<Option<AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>, CreateEntryError<Self::InternalError, P::Error, AT::CreationError>>
where Data: ?Sized + Namespaced<N> + Coordinatelike<MCL, MCC, MPL, S>, P: BulkProducer<Item = u8, Final = ()>, H: Default + Hasher<PD>, AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD> + Debug, N: Debug, S: Debug, PD: Debug,

Creates an AuthorisedEntry with the given data and payload, and atomically inserts the payload and entry into the store. Read more
Source§

async fn create_entry_nondestructive<Data, P, H>( &mut self, data: &Data, payload_producer: P, payload_length: u64, ingredients: &AT::Ingredients, ) -> Result<NondestructiveInsert<MCL, MCC, MPL, N, S, PD, AT>, CreateEntryError<Self::InternalError, P::Error, AT::CreationError>>
where Data: ?Sized + Namespaced<N> + Coordinatelike<MCL, MCC, MPL, S>, P: BulkProducer<Item = u8, Final = ()>, H: Default + Hasher<PD>, AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD> + Debug, N: Debug, S: Debug, PD: Debug,

Creates an Entry with the given data and payload, and atomically inserts the payload and entry into the store, unless it would prune one or more older entries. Read more
Source§

async fn insert_entry( &mut self, entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, ) -> Result<bool, Self::InternalError>

Inserts a given AuthorisedEntry into the store. Read more
Source§

async fn forget_entry<K>( &mut self, namespace_id: &N, key: &K, expected_digest: Option<PD>, ) -> Result<bool, Self::InternalError>
where K: Keylike<MCL, MCC, MPL, S>, PD: PartialEq,

Removes an entry and its payload from the store. Return Ok(true) if data was actually removed, and Ok(false) if there was no matching entry in the first place. Read more
Source§

async fn forget_area( &mut self, namespace_id: &N, area: &Area<MCL, MCC, MPL, S>, ) -> Result<(), Self::InternalError>

Removes all entries and their payloads in some Area from the store. Read more
Source§

async fn forget_namespace( &mut self, namespace_id: &N, ) -> Result<(), Self::InternalError>

Removes all entries and their payloads in some namespace from the store. Read more
Source§

async fn get_entry<K, Slice>( &mut self, namespace_id: &N, key: &K, expected_digest: Option<PD>, payload_slice: &Slice, ) -> Result<Option<(AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, impl BulkProducer<Item = u8, Final = (), Error = PayloadProducerError<Self::InternalError>>)>, Self::InternalError>
where K: Keylike<MCL, MCC, MPL, S>, Slice: RangeBounds<u64>,

Gets an entry (or None if there is none) together with a producer its payload (more specifically, the indicated payload_slice). Read more
Source§

async fn get_area( &mut self, namespace_id: N, area: Area<MCL, MCC, MPL, S>, ) -> impl Producer<Item = AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, Final = (), Error = Self::InternalError>

Returns a producer of all entries in some Area from the store.

Auto Trait Implementations§

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Freeze for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !RefUnwindSafe for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !Send for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !Sync for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> Unpin for MemoryStore<MCL, MCC, MPL, N, S, PD, AT>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT> !UnwindSafe for MemoryStore<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.