pub trait StateStoreWrite: StaticSendSync {
// Required method
fn ingest_batch(
&self,
kv_pairs: Vec<(TableKey<Bytes>, StorageValue)>,
delete_ranges: Vec<(Bound<Bytes>, Bound<Bytes>)>,
write_options: WriteOptions,
) -> StorageResult<usize>;
}
Required Methods§
sourcefn ingest_batch(
&self,
kv_pairs: Vec<(TableKey<Bytes>, StorageValue)>,
delete_ranges: Vec<(Bound<Bytes>, Bound<Bytes>)>,
write_options: WriteOptions,
) -> StorageResult<usize>
fn ingest_batch( &self, kv_pairs: Vec<(TableKey<Bytes>, StorageValue)>, delete_ranges: Vec<(Bound<Bytes>, Bound<Bytes>)>, write_options: WriteOptions, ) -> StorageResult<usize>
Writes a batch to storage. The batch should be:
- Ordered. KV pairs will be directly written to the table, so it must be ordered.
- Locally unique. There should not be two or more operations on the same key in one write batch.
Ingests a batch of data into the state store. One write batch should never contain operation on the same key. e.g. Put(233, x) then Delete(233). An epoch should be provided to ingest a write batch. It is served as:
- A handle to represent an atomic write session. All ingested write batches associated with
the same
Epoch
have the all-or-nothing semantics, meaning that partial changes are not queryable and will be rolled back if instructed. - A version of a kv pair. kv pair associated with larger
Epoch
is guaranteed to be newer then kv pair with smallerEpoch
. Currently this version is only used to derive the per-key modification history (e.g. in compaction), not across different keys.