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>
impl<R: AsyncRawKv> AsyncFlatEngine<R>
Sourcepub async fn prefix_of(
&self,
dir: &[&[u8]],
) -> Result<Option<Vec<u8>>, FlatError<R::Error>>
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.
Sourcepub async fn allocate_dir(
&mut self,
dir: &[&[u8]],
) -> Result<Vec<u8>, FlatError<R::Error>>
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.
Sourcepub async fn get(
&self,
dir: &[&[u8]],
key: &[u8],
) -> Result<Option<Vec<u8>>, FlatError<R::Error>>
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).
Sourcepub async fn exists(
&self,
dir: &[&[u8]],
key: &[u8],
) -> Result<bool, FlatError<R::Error>>
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).
Sourcepub async fn scan(
&self,
dir: &[&[u8]],
start: Bound<&[u8]>,
end: Bound<&[u8]>,
forward: bool,
) -> Result<Vec<KvPair>, FlatError<R::Error>>
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.
Sourcepub async fn data_bounds(
&self,
dir: &[&[u8]],
start: Bound<&[u8]>,
end: Bound<&[u8]>,
) -> Result<Option<DataBounds>, FlatError<R::Error>>
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.
Sourcepub async fn set(
&mut self,
dir: &[&[u8]],
key: &[u8],
value: &[u8],
) -> Result<(), FlatError<R::Error>>
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.
Sourcepub async fn delete(
&mut self,
dir: &[&[u8]],
key: &[u8],
) -> Result<(), FlatError<R::Error>>
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).
Sourcepub async fn clear_range(
&mut self,
dir: &[&[u8]],
start: Bound<&[u8]>,
end: Bound<&[u8]>,
) -> Result<(), FlatError<R::Error>>
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).
Sourcepub async fn list_dirs(
&self,
dir: &[&[u8]],
) -> Result<Vec<Vec<u8>>, FlatError<R::Error>>
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.