MCPcopy
hub / github.com/dgraph-io/dgraph / SetAt

Method SetAt

posting/writer.go:78–102  ·  view source on GitHub ↗

SetAt writes a key-value pair at the given timestamp.

(key, val []byte, meta byte, ts uint64)

Source from the content-addressed store, hash-verified

76
77// SetAt writes a key-value pair at the given timestamp.
78func (w *TxnWriter) SetAt(key, val []byte, meta byte, ts uint64) error {
79 return w.update(ts, func(txn *badger.Txn) error {
80 switch meta {
81 case BitCompletePosting, BitEmptyPosting:
82 err := txn.SetEntry((&badger.Entry{
83 Key: key,
84 Value: val,
85 UserMeta: meta,
86 }).WithDiscard())
87 if err != nil {
88 return err
89 }
90 default:
91 err := txn.SetEntry(&badger.Entry{
92 Key: key,
93 Value: val,
94 UserMeta: meta,
95 })
96 if err != nil {
97 return err
98 }
99 }
100 return nil
101 })
102}
103
104// Flush waits until all operations are done and all data is written to disk.
105func (w *TxnWriter) Flush() error {

Callers 7

writeMethod · 0.95
writePostingListToDiskFunction · 0.95
TestPostingListReadFunction · 0.95
TestReadSingleValueFunction · 0.95
writePostingListToDiskFunction · 0.95
BenchmarkWriterFunction · 0.95
WriteMethod · 0.95

Calls 1

updateMethod · 0.95

Tested by 5

writePostingListToDiskFunction · 0.76
TestPostingListReadFunction · 0.76
TestReadSingleValueFunction · 0.76
writePostingListToDiskFunction · 0.76
BenchmarkWriterFunction · 0.76