pub struct WriteBatch { /* private fields */ }Expand description
| WriteBatch::rep_ := | sequence: fixed64 | count: fixed32 | data: record[count] | record := | kTypeValue varstring varstring | | kTypeDeletion varstring | varstring := | len: varint32 | data: uint8[len]
Implementations§
Source§impl WriteBatch
impl WriteBatch
pub fn new() -> Self
Sourcepub fn approximate_size(&self) -> usize
pub fn approximate_size(&self) -> usize
| The size of the database changes caused by | this batch. | | This number is tied to implementation | details, and may change across releases. It | is intended for LevelDB usage metrics.
Sourcepub fn iterate(&self, handler: *mut dyn WriteBatchHandler) -> Status
pub fn iterate(&self, handler: *mut dyn WriteBatchHandler) -> Status
| Support for iterating over the contents | of a batch. |
Sourcepub fn put(&mut self, key_: &Slice, value: &Slice)
pub fn put(&mut self, key_: &Slice, value: &Slice)
| Store the mapping “key->value” in the | database. |
Sourcepub fn delete(&mut self, key_: &Slice)
pub fn delete(&mut self, key_: &Slice)
| If the database contains a mapping for | “key”, erase it. Else do nothing. |
Sourcepub fn append(&mut self, source: &WriteBatch)
pub fn append(&mut self, source: &WriteBatch)
| Copies the operations in “source” to this | batch. | | This runs in O(source size) time. However, | the constant factor is better than calling | Iterate() over the source batch with | a Handler that replicates the operations into | this batch.