pub struct Database { /* private fields */ }
Expand description
Database backed by both IndexedDB and in memory implementation.
Implementations§
Trait Implementations§
Source§impl KeyValueDB for Database
impl KeyValueDB for Database
Source§fn get<'a>(
&self,
col: u32,
key: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
fn get<'a>( &self, col: u32, key: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
Get a value by key.
Source§fn delete<'a>(
&self,
col: u32,
key: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
fn delete<'a>( &self, col: u32, key: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
Remove a value by key, returning the old value
Source§fn write(
&self,
transaction: DBTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), DBTransactionError>> + Send + 'static>>
fn write( &self, transaction: DBTransaction, ) -> Pin<Box<dyn Future<Output = Result<(), DBTransactionError>> + Send + 'static>>
Write a transaction of changes to the backing store.
Source§fn iter<'a, T: 'a, F: FnMut(DBKeyValueRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>(
&self,
col: u32,
prefix: Option<&'a [u8]>,
f: F,
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
fn iter<'a, T: 'a, F: FnMut(DBKeyValueRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>( &self, col: u32, prefix: Option<&'a [u8]>, f: F, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
Iterate over the data for a given column.
Return all key/value pairs, optionally where the key starts with the given prefix.
Iterator closure returns true for more items, false to stop iteration.
Source§fn iter_keys<'a, T: 'a, F: FnMut(DBKeyRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>(
&self,
col: u32,
prefix: Option<&'a [u8]>,
f: F,
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
fn iter_keys<'a, T: 'a, F: FnMut(DBKeyRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>( &self, col: u32, prefix: Option<&'a [u8]>, f: F, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
Iterate over the data for a given column.
Return all keys, optionally where the key starts with the given prefix.
Iterator closure returns true for more items, false to stop iteration.
Source§fn num_keys(
&self,
col: u32,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send>>
fn num_keys( &self, col: u32, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send>>
The number of keys in a column (estimated).
Source§fn restore(&self, _new_db: &str) -> Result<()>
fn restore(&self, _new_db: &str) -> Result<()>
Attempt to replace this database with a new one located at the given path.
Source§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
Source§fn has_key<'a>(
&self,
col: u32,
key: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'a>>
fn has_key<'a>( &self, col: u32, key: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'a>>
Check for the existence of a value by key.
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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