Struct radarbase::WriteTransaction
source · pub struct WriteTransaction<'mmap, K: RadbKey + ?Sized> {
storage: &'mmap Storage,
table_id: u64,
added: HashMap<Vec<u8>, Vec<u8>>,
removed: HashSet<Vec<u8>>,
_key_type: PhantomData<K>,
}
Fields§
§storage: &'mmap Storage
§table_id: u64
§added: HashMap<Vec<u8>, Vec<u8>>
§removed: HashSet<Vec<u8>>
§_key_type: PhantomData<K>
Implementations§
source§impl<'mmap, K: RadbKey + ?Sized> WriteTransaction<'mmap, K>
impl<'mmap, K: RadbKey + ?Sized> WriteTransaction<'mmap, K>
pub(crate) fn new( table_id: u64, storage: &'mmap Storage ) -> WriteTransaction<'mmap, K>
pub fn insert(&mut self, key: &K, value: &[u8]) -> Result<(), Error>
sourcepub fn insert_reserve(
&mut self,
key: &K,
value_length: usize
) -> Result<&mut [u8], Error>
pub fn insert_reserve( &mut self, key: &K, value_length: usize ) -> Result<&mut [u8], Error>
Reserve space to insert a key-value pair (without knowing the value yet) The returned reference will have length equal to value_length
sourcepub fn get(&self, key: &K) -> Result<Option<AccessGuard<'_>>, Error>
pub fn get(&self, key: &K) -> Result<Option<AccessGuard<'_>>, Error>
Get a value from the transaction. If the value is not in the data, it will be fetched from the mmap disk storage.
pub fn remove(&mut self, key: &K) -> Result<(), Error>
pub fn abort(self) -> Result<(), Error>
Auto Trait Implementations§
impl<'mmap, K> !RefUnwindSafe for WriteTransaction<'mmap, K>
impl<'mmap, K> !Send for WriteTransaction<'mmap, K>
impl<'mmap, K> !Sync for WriteTransaction<'mmap, K>
impl<'mmap, K: ?Sized> Unpin for WriteTransaction<'mmap, K>where
K: Unpin,
impl<'mmap, K> !UnwindSafe for WriteTransaction<'mmap, K>
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