Enum foyer_storage::Store

source ·
pub enum Store<K, V>
where K: StorageKey, V: StorageValue,
{ None(NoneStore<K, V>), Fs(GenericStore<K, V, FsDevice>), LazyFs(Lazy<K, V, GenericStore<K, V, FsDevice>>), RuntimeFs(Runtime<K, V, GenericStore<K, V, FsDevice>>), RuntimeLazyFs(Runtime<K, V, Lazy<K, V, GenericStore<K, V, FsDevice>>>), }

Variants§

§

None(NoneStore<K, V>)

§

Fs(GenericStore<K, V, FsDevice>)

§

LazyFs(Lazy<K, V, GenericStore<K, V, FsDevice>>)

§

RuntimeFs(Runtime<K, V, GenericStore<K, V, FsDevice>>)

§

RuntimeLazyFs(Runtime<K, V, Lazy<K, V, GenericStore<K, V, FsDevice>>>)

Trait Implementations§

source§

impl<K, V> Clone for Store<K, V>
where K: StorageKey, V: StorageValue,

source§

fn clone(&self) -> Self

Returns a copy 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<K, V> Debug for Store<K, V>
where K: StorageKey, V: StorageValue,

source§

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

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

impl<K, V> Storage<K, V> for Store<K, V>
where K: StorageKey, V: StorageValue,

§

type Config = StoreConfig<K, V>

§

type Writer = StoreWriter<K, V>

source§

async fn open(config: Self::Config) -> Result<Self>

source§

fn is_ready(&self) -> bool

source§

async fn close(&self) -> Result<()>

source§

fn writer<AK>(&self, key: AK) -> Self::Writer
where AK: Into<Arc<K>> + Send + 'static,

source§

fn exists<Q>(&self, key: &Q) -> Result<bool>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source§

fn get<Q>( &self, key: &Q ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + 'static
where K: Borrow<Q>, Q: Hash + Eq + ?Sized + Send + Sync + 'static,

source§

fn remove<Q>(&self, key: &Q) -> Result<bool>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source§

fn clear(&self) -> Result<()>

Auto Trait Implementations§

§

impl<K, V> Freeze for Store<K, V>

§

impl<K, V> !RefUnwindSafe for Store<K, V>

§

impl<K, V> Send for Store<K, V>

§

impl<K, V> Sync for Store<K, V>

§

impl<K, V> Unpin for Store<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> !UnwindSafe for Store<K, V>

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<K, V, S> AsyncStorageExt<K, V> for S
where K: StorageKey, V: StorageValue, S: Storage<K, V>,

source§

fn insert_async<AK, AV>(&self, key: AK, value: AV)
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static,

source§

fn insert_if_not_exists_async<AK, AV>(&self, key: AK, value: AV)
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static,

source§

fn insert_async_with_callback<AK, AV, F, FU>(&self, key: AK, value: AV, f: F)
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce(Result<Option<CachedEntry<K, V>>>) -> FU + Send + 'static, FU: Future<Output = ()> + Send + 'static,

source§

fn insert_if_not_exists_async_with_callback<AK, AV, F, FU>( &self, key: AK, value: AV, f: F )
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce(Result<bool>) -> FU + Send + 'static, FU: Future<Output = ()> + Send + 'static,

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<K, V, S> ForceStorageExt<K, V> for S
where K: StorageKey, V: StorageValue, S: Storage<K, V>,

source§

fn insert_force<AK, AV>( &self, key: AK, value: AV ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static,

source§

fn insert_force_with<AK, AV, F>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> Result<AV> + Send,

First judge if the entry will be admitted with key and weight by admission policies. Then f will be called and entry will be inserted. Read more
source§

fn insert_force_with_future<AK, AV, F, FU>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> FU + Send, FU: FetchValueFuture<V>,

First judge if the entry will be admitted with key and weight by admission policies. Then f will be called to fetch value, and entry will be inserted. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

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<K, V, S> StorageExt<K, V> for S
where K: StorageKey, V: StorageValue, S: Storage<K, V>,

source§

fn insert<AK, AV>( &self, key: AK, value: AV ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static,

source§

fn insert_if_not_exists<AK, AV>( &self, key: AK, value: AV ) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static,

source§

fn insert_with<AK, AV, F>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> Result<AV> + Send,

First judge if the entry will be admitted with key and weight by admission policies. Then f will be called and entry will be inserted. Read more
source§

fn insert_with_future<AV, AK, F, FU>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> FU + Send, FU: FetchValueFuture<AV>,

First judge if the entry will be admitted with key and weight by admission policies. Then f will be called to fetch value, and entry will be inserted.
source§

fn insert_if_not_exists_with<AV, AK, F>( &self, key: AK, f: F ) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> Result<AV> + Send,

source§

fn insert_if_not_exists_with_future<AK, AV, F, FU>( &self, key: AK, f: F ) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static, AV: Into<Arc<V>> + Send + 'static, F: FnOnce() -> FU + Send, FU: FetchValueFuture<AV>,

source§

impl<T> ToOwned for T
where T: Clone,

§

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

§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Value for T
where T: Send + Sync + 'static,