pub struct DBTransaction<D, T>where
D: 'static,
T: 'static,{
pub tx: Arc<Mutex<Option<T>>>,
pub ok: bool,
pub writable: bool,
pub readable: bool,
pub timestamp: i64,
pub _db: Pin<Arc<D>>,
}
Expand description
§Distributed Database Transaction
§Atomically reference counter
Shared references in Rust disallow mutation by default, and Arc is no exception: you cannot generally obtain a mutable reference to something inside an Arc. If you need to mutate through an Arc, use Mutex, RwLock, or one of the Atomic types.
because it tries to borrow arc as mutable. For it to happen, DerefMut would have to be implemented for Arc but it’s not because Arc is not meant to be mutable.
Fields§
§tx: Arc<Mutex<Option<T>>>
§ok: bool
§writable: bool
§readable: bool
§timestamp: i64
§_db: Pin<Arc<D>>
Implementations§
Trait Implementations§
Source§impl<D, T> Debug for DBTransaction<D, T>
impl<D, T> Debug for DBTransaction<D, T>
Source§impl SimpleTransaction for DBTransaction<OptimisticTransactionDB, Transaction<'static, OptimisticTransactionDB>>
impl SimpleTransaction for DBTransaction<OptimisticTransactionDB, Transaction<'static, OptimisticTransactionDB>>
fn closed(&self) -> bool
fn count<'life0, 'async_trait>(
&'life0 mut self,
cf: CF,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exi<'life0, 'async_trait, K>( &'life0 self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>
Source§fn get<'life0, 'async_trait, K>(
&'life0 self,
cf: CF,
key: K,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + 'async_trait>>
fn get<'life0, 'async_trait, K>( &'life0 self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + 'async_trait>>
Fetch a key from the database
fn multi_get<'life0, 'async_trait, K>( &'life0 self, cf: CF, keys: Vec<K>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Vec<u8>>>, Error>> + 'async_trait>>
Source§fn set<'life0, 'async_trait, K, V>(
&'life0 mut self,
cf: CF,
key: K,
val: V,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn set<'life0, 'async_trait, K, V>( &'life0 mut self, cf: CF, key: K, val: V, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Insert or update a key in the database
Source§fn put<'life0, 'async_trait, K, V>(
&'life0 mut self,
cf: CF,
key: K,
val: V,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn put<'life0, 'async_trait, K, V>( &'life0 mut self, cf: CF, key: K, val: V, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Insert a key if it doesn’t exist in the database
Source§fn del<'life0, 'async_trait, K>(
&'life0 mut self,
cf: CF,
key: K,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn del<'life0, 'async_trait, K>( &'life0 mut self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Delete a key
fn iterate<'life0, 'async_trait>(
&'life0 self,
cf: CF,
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn suffix_iterate<'life0, 'async_trait, S>( &'life0 self, cf: CF, suffix: S, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>
fn prefix_iterate<'life0, 'async_trait, P>( &'life0 self, cf: CF, prefix: P, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>
Source§impl SimpleTransaction for DBTransaction<Database, WriteTransaction<'static>>
impl SimpleTransaction for DBTransaction<Database, WriteTransaction<'static>>
fn closed(&self) -> bool
fn count<'life0, 'async_trait>(
&'life0 mut self,
cf: CF,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exi<'life0, 'async_trait, K>( &'life0 self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + 'async_trait>>
Source§fn get<'life0, 'async_trait, K>(
&'life0 self,
cf: CF,
key: K,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + 'async_trait>>
fn get<'life0, 'async_trait, K>( &'life0 self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + 'async_trait>>
Fetch a key from the database
Source§fn set<'life0, 'async_trait, K, V>(
&'life0 mut self,
cf: CF,
key: K,
val: V,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn set<'life0, 'async_trait, K, V>( &'life0 mut self, cf: CF, key: K, val: V, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Insert or update a key in the database
Source§fn put<'life0, 'async_trait, K, V>(
&'life0 mut self,
cf: CF,
key: K,
val: V,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn put<'life0, 'async_trait, K, V>( &'life0 mut self, cf: CF, key: K, val: V, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Insert a key if it doesn’t exist in the database
Source§fn del<'life0, 'async_trait, K>(
&'life0 mut self,
cf: CF,
key: K,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
fn del<'life0, 'async_trait, K>( &'life0 mut self, cf: CF, key: K, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
Delete a key
fn iterate<'life0, 'async_trait>(
&'life0 self,
cf: CF,
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prefix_iterate<'life0, 'async_trait, P>( &'life0 self, cf: CF, prefix: P, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>
fn suffix_iterate<'life0, 'async_trait, S>( &'life0 self, cf: CF, suffix: S, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<(Vec<u8>, Vec<u8>), Error>>, Error>> + 'async_trait>>
fn multi_get<'life0, 'async_trait, K>( &'life0 self, _cf: CF, _keys: Vec<K>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Vec<u8>>>, Error>> + 'async_trait>>
Auto Trait Implementations§
impl<D, T> Freeze for DBTransaction<D, T>
impl<D, T> !RefUnwindSafe for DBTransaction<D, T>
impl<D, T> Send for DBTransaction<D, T>
impl<D, T> Sync for DBTransaction<D, T>
impl<D, T> Unpin for DBTransaction<D, T>
impl<D, T> !UnwindSafe for DBTransaction<D, T>
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