Skip to main content

Store

Struct Store 

Source
pub struct Store<B> { /* private fields */ }
Expand description

Node values under their keys: a render stages, and only persist commits each value whole by rename, evicting the least recently used past the budget. Every change to the backend’s names runs under its lock; lookups and reads never wait on it.

Implementations§

Source§

impl<B: Backend> Store<B>

Source

pub async fn open(backend: B, max_bytes: u64) -> Result<Store<B>, String>

A store of another format is emptied first.

Source

pub fn max_bytes(&self) -> u64

Source

pub fn bytes(&self) -> u64

Source

pub fn holds(&self, key: Hash) -> bool

Source

pub async fn persist(&self) -> Result<Persisted, String>

A value staged without its meta is dropped. A key leaves the staging record only once its files have, so a failed write leaves every later one staged, as does a commit over an open entry. An open entry past budget stays for the next persist.

Trait Implementations§

Source§

impl<B: Backend> Through for Store<B>

Source§

fn lookup(&self, key: Hash) -> impl Future<Output = Option<Stored>>

Source§

fn read( &self, stored: &Stored, over: Extent, ) -> impl Future<Output = Option<Vec<Buffer>>>

Whole chunks holding over; None where they are gone or corrupt.
Source§

fn epoch(&self) -> u64

Moves on whenever this holder stages or commits.

Auto Trait Implementations§

§

impl<B> !Freeze for Store<B>

§

impl<B> RefUnwindSafe for Store<B>
where B: RefUnwindSafe,

§

impl<B> Send for Store<B>
where B: Send,

§

impl<B> Sync for Store<B>
where B: Sync,

§

impl<B> Unpin for Store<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for Store<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for Store<B>
where B: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.