Add records a value in Badger which will eventually be merged by a background routine into the values that were recorded by previous invocations to Add().
(val []byte)
| 147 | // Add records a value in Badger which will eventually be merged by a background |
| 148 | // routine into the values that were recorded by previous invocations to Add(). |
| 149 | func (op *MergeOperator) Add(val []byte) error { |
| 150 | return op.db.Update(func(txn *Txn) error { |
| 151 | return txn.SetEntry(NewEntry(op.key, val).withMergeBit()) |
| 152 | }) |
| 153 | } |
| 154 | |
| 155 | // Get returns the latest value for the merge operator, which is derived by |
| 156 | // applying the merge function to all the values added so far. |
nothing calls this directly
no test coverage detected