pub trait MergeOperator: Send + Sync {
// Required method
fn merge_batch(
&self,
key: &Bytes,
existing_value: Option<Bytes>,
operands: &[Bytes],
) -> Bytes;
}Expand description
Trait for merging existing values with new values.
Merge operators must be associative: merge_batch(merge_batch(a, [b]), [c]) == merge_batch(a, merge_batch(b, [c])).
This ensures consistent merging behavior regardless of the order of operations.
Required Methods§
Sourcefn merge_batch(
&self,
key: &Bytes,
existing_value: Option<Bytes>,
operands: &[Bytes],
) -> Bytes
fn merge_batch( &self, key: &Bytes, existing_value: Option<Bytes>, operands: &[Bytes], ) -> Bytes
Merges a batch of operands with an optional existing value.
§Arguments
key- The key associated with the values being mergedexisting_value- The current value stored in the database (if any)operands- A slice of operands to merge, ordered from oldest to newest