pub struct AsyncStorage<B: AsyncStorageBackend> { /* private fields */ }Implementations§
Source§impl<B: AsyncStorageBackend> AsyncStorage<B>
impl<B: AsyncStorageBackend> AsyncStorage<B>
pub fn new(backend: B) -> Self
Sourcepub async fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>
pub async fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>
pub async fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn remove(&self, key: &[u8]) -> Result<()>
pub async fn remove(&self, key: &[u8]) -> Result<()>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn prefix_scan(
&self,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
pub async fn prefix_scan( &self, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn prefix_count(&self, prefix: &[u8]) -> Result<usize>
pub async fn prefix_count(&self, prefix: &[u8]) -> Result<usize>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn prefix_scan_keys(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>>
pub async fn prefix_scan_keys(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn prefix_scan_batch(
&self,
prefix: &[u8],
batch_size: usize,
after_key: Option<&[u8]>,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
pub async fn prefix_scan_batch( &self, prefix: &[u8], batch_size: usize, after_key: Option<&[u8]>, ) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
§Errors
Returns an error if the storage operation fails.
Sourcepub async fn range_scan(
&self,
start: &[u8],
end: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
pub async fn range_scan( &self, start: &[u8], end: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
§Errors
Returns an error if the storage operation fails.
pub fn batch(&self) -> AsyncBatchWriter<B::Batch>
Auto Trait Implementations§
impl<B> Freeze for AsyncStorage<B>where
B: Freeze,
impl<B> RefUnwindSafe for AsyncStorage<B>where
B: RefUnwindSafe,
impl<B> Send for AsyncStorage<B>where
B: Send,
impl<B> Sync for AsyncStorage<B>where
B: Sync,
impl<B> Unpin for AsyncStorage<B>where
B: Unpin,
impl<B> UnsafeUnpin for AsyncStorage<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for AsyncStorage<B>where
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more