Struct ckb_store::StoreWriteBatch

source ·
pub struct StoreWriteBatch { /* private fields */ }
Expand description

Wrapper of RocksDBWriteBatch, provides atomic batch of write operations.

Implementations§

source§

impl StoreWriteBatch

source

pub fn put(&mut self, col: Col, key: &[u8], value: &[u8]) -> Result<(), Error>

Write the bytes into the given column with associated key.

source

pub fn delete(&mut self, col: Col, key: &[u8]) -> Result<(), Error>

Delete the data associated with the given key and given column.

source

pub fn size_in_bytes(&self) -> usize

Return WriteBatch serialized size (in bytes).

source

pub fn len(&self) -> usize

Return the count of write batch.

source

pub fn is_empty(&self) -> bool

Returns true if the write batch contains no operations.

source

pub fn clear(&mut self) -> Result<(), Error>

Clear all updates buffered in this batch.

source

pub fn insert_cells( &mut self, cells: impl Iterator<Item = (OutPoint, CellEntry, Option<CellDataEntry>)> ) -> Result<(), Error>

Put cells into this write batch

source

pub fn delete_cells( &mut self, out_points: impl Iterator<Item = OutPoint> ) -> Result<(), Error>

Remove cells from this write batch

source

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

source

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§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Cast to trait Any
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V