Skip to main content

AsyncFlatEngine

Struct AsyncFlatEngine 

Source
pub struct AsyncFlatEngine<R: AsyncRawKv> { /* private fields */ }
Expand description

The flat directory layout over an asynchronous raw byte view.

Mirrors FlatEngine over AsyncRawKv so asynchronous backends share the exact FoundationDB DirectoryLayer layout, tuple encoding, HCA window rules, and error contract without copying the database into memory.

Implementations§

Source§

impl<R: AsyncRawKv> AsyncFlatEngine<R>

Source

pub fn new(raw: R) -> Self

Wrap an asynchronous raw view.

Source

pub fn raw(&self) -> &R

The underlying view.

Source

pub fn raw_mut(&mut self) -> &mut R

The mutable underlying view.

Source

pub fn into_raw(self) -> R

Consume the engine and return its underlying view.

Source

pub async fn prefix_of( &self, dir: &[&[u8]], ) -> Result<Option<Vec<u8>>, FlatError<R::Error>>

Resolve dir to its allocated prefix.

Returns Ok(None) when the store is fresh or dir does not exist.

Source

pub async fn allocate_dir( &mut self, dir: &[&[u8]], ) -> Result<Vec<u8>, FlatError<R::Error>>

Resolve dir, allocating any missing directories (and the anchor and version row on a fresh store) along the path.

Source

pub async fn get( &self, dir: &[&[u8]], key: &[u8], ) -> Result<Option<Vec<u8>>, FlatError<R::Error>>

Get key within dir. A missing directory yields Ok(None).

Source

pub async fn exists( &self, dir: &[&[u8]], key: &[u8], ) -> Result<bool, FlatError<R::Error>>

Check whether key exists within dir. A missing directory yields Ok(false).

Source

pub async fn scan( &self, dir: &[&[u8]], start: Bound<&[u8]>, end: Bound<&[u8]>, forward: bool, ) -> Result<Vec<KvPair>, FlatError<R::Error>>

Scan within dir between start and end, ascending or descending. A missing directory yields no rows.

Source

pub async fn data_bounds( &self, dir: &[&[u8]], start: Bound<&[u8]>, end: Bound<&[u8]>, ) -> Result<Option<DataBounds>, FlatError<R::Error>>

Resolve dir and map within-directory bounds to raw engine bounds.

Source

pub async fn set( &mut self, dir: &[&[u8]], key: &[u8], value: &[u8], ) -> Result<(), FlatError<R::Error>>

Set key within dir, allocating dir and any missing ancestors if needed.

Source

pub async fn delete( &mut self, dir: &[&[u8]], key: &[u8], ) -> Result<(), FlatError<R::Error>>

Delete key within dir (a no-op if the directory or key is absent).

Source

pub async fn clear_range( &mut self, dir: &[&[u8]], start: Bound<&[u8]>, end: Bound<&[u8]>, ) -> Result<(), FlatError<R::Error>>

Clear start <= k < end within dir (a no-op if dir does not exist).

Source

pub async fn list_dirs( &self, dir: &[&[u8]], ) -> Result<Vec<Vec<u8>>, FlatError<R::Error>>

List the immediate child segment names under dir, sorted ascending.

Source

pub async fn dir_exists( &self, dir: &[&[u8]], ) -> Result<bool, FlatError<R::Error>>

Whether dir exists.

Source

pub async fn remove_dir( &mut self, dir: &[&[u8]], ) -> Result<bool, FlatError<R::Error>>

Remove dir recursively: its subdirectories and its own key data.

Auto Trait Implementations§

§

impl<R> Forget for AsyncFlatEngine<R>

§

impl<R> Freeze for AsyncFlatEngine<R>
where R: Freeze,

§

impl<R> Move for AsyncFlatEngine<R>

§

impl<R> RefUnwindSafe for AsyncFlatEngine<R>
where R: RefUnwindSafe,

§

impl<R> Send for AsyncFlatEngine<R>

§

impl<R> Sync for AsyncFlatEngine<R>

§

impl<R> Unpin for AsyncFlatEngine<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for AsyncFlatEngine<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for AsyncFlatEngine<R>
where R: 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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

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.