Module rocks::merge_operator
[−]
[src]
The Merge Operator
Essentially, a MergeOperator specifies the SEMANTICS of a merge, which only client knows. It could be numeric addition, list append, string concatenation, edit data structure, ... , anything. The library, on the other hand, is concerned with the exercise of this interface, at the right time (during get, iteration, compaction...)
To use merge, the client needs to provide an object implementing one of the following interfaces:
AssociativeMergeOperator
- for most simple semantics (always take two values, and merge them into one value, which is then put back into rocksdb); numeric addition and string concatenation are examples;MergeOperator
- the generic class for all the more abstract / complex operations; one method (FullMergeV2) to merge a Put/Delete value with a merge operand; and another method (PartialMerge) that merges multiple operands together. this is especially useful if your key values have complex structures but you would still like to support client-specific incremental updates.
AssociativeMergeOperator
is simpler to implement. MergeOperator
is simply
more powerful.
Refer to rocksdb-merge wiki for more details and example implementations.
Structs
MergeOperationInput | |
MergeOperationOutput |
Traits
AssociativeMergeOperator |
|
MergeOperator |
|