pub struct StoreWriteBatch { /* private fields */ }
Expand description
Wrapper of RocksDBWriteBatch
, provides atomic batch of write operations.
Implementations§
Source§impl StoreWriteBatch
impl StoreWriteBatch
Sourcepub fn put(&mut self, col: Col, key: &[u8], value: &[u8]) -> Result<(), Error>
pub fn put(&mut self, col: Col, key: &[u8], value: &[u8]) -> Result<(), Error>
Write the bytes into the given column with associated key.
Sourcepub fn delete(&mut self, col: Col, key: &[u8]) -> Result<(), Error>
pub fn delete(&mut self, col: Col, key: &[u8]) -> Result<(), Error>
Delete the data associated with the given key and given column.
Sourcepub fn size_in_bytes(&self) -> usize
pub fn size_in_bytes(&self) -> usize
Return WriteBatch serialized size (in bytes).
Sourcepub fn insert_cells(
&mut self,
cells: impl Iterator<Item = (OutPoint, CellEntry, Option<CellDataEntry>)>,
) -> Result<(), Error>
pub fn insert_cells( &mut self, cells: impl Iterator<Item = (OutPoint, CellEntry, Option<CellDataEntry>)>, ) -> Result<(), Error>
Put cells into this write batch
Sourcepub fn delete_cells(
&mut self,
out_points: impl Iterator<Item = OutPoint>,
) -> Result<(), Error>
pub fn delete_cells( &mut self, out_points: impl Iterator<Item = OutPoint>, ) -> Result<(), Error>
Remove cells from this write batch
Sourcepub fn delete_block_body(
&mut self,
number: BlockNumber,
hash: &Byte32,
txs_len: u32,
) -> Result<(), Error>
pub fn delete_block_body( &mut self, number: BlockNumber, hash: &Byte32, txs_len: u32, ) -> Result<(), Error>
Removes the block body from database with corresponding hash, number and txs number
Sourcepub fn delete_block(
&mut self,
number: BlockNumber,
hash: &Byte32,
txs_len: u32,
) -> Result<(), Error>
pub fn delete_block( &mut self, number: BlockNumber, hash: &Byte32, txs_len: u32, ) -> Result<(), Error>
Removes the entire block from database with corresponding hash, number and txs number
Auto Trait Implementations§
impl Freeze for StoreWriteBatch
impl RefUnwindSafe for StoreWriteBatch
impl !Send for StoreWriteBatch
impl !Sync for StoreWriteBatch
impl Unpin for StoreWriteBatch
impl UnwindSafe for StoreWriteBatch
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more