MCPcopy
hub / github.com/dgraph-io/badger / Add

Method Add

merge.go:149–153  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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().
149func (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.

Callers

nothing calls this directly

Calls 4

NewEntryFunction · 0.85
withMergeBitMethod · 0.80
UpdateMethod · 0.45
SetEntryMethod · 0.45

Tested by

no test coverage detected