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

Method NewWriteBatchAt

managed_db.go:45–54  ·  view source on GitHub ↗

NewWriteBatchAt is similar to NewWriteBatch but it allows user to set the commit timestamp. NewWriteBatchAt is supposed to be used only in the managed mode.

(commitTs uint64)

Source from the content-addressed store, hash-verified

43// NewWriteBatchAt is similar to NewWriteBatch but it allows user to set the commit timestamp.
44// NewWriteBatchAt is supposed to be used only in the managed mode.
45func (db *DB) NewWriteBatchAt(commitTs uint64) *WriteBatch {
46 if !db.opt.managedTxns {
47 panic("cannot use NewWriteBatchAt with managedDB=false. Use NewWriteBatch instead")
48 }
49
50 wb := db.newWriteBatch(true)
51 wb.commitTs = commitTs
52 wb.txn.commitTs = commitTs
53 return wb
54}
55func (db *DB) NewManagedWriteBatch() *WriteBatch {
56 if !db.opt.managedTxns {
57 panic("cannot use NewManagedWriteBatch with managedDB=false. Use NewWriteBatch instead")

Callers 4

TestEmptyWriteBatchFunction · 0.80
TestWriteBatchDuplicateFunction · 0.80
TestBigStreamFunction · 0.80

Calls 1

newWriteBatchMethod · 0.95

Tested by 4

TestEmptyWriteBatchFunction · 0.64
TestWriteBatchDuplicateFunction · 0.64
TestBigStreamFunction · 0.64