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

Function buildL0Table

db.go:972–989  ·  view source on GitHub ↗

buildL0Table builds a new table from the memtable.

(ft flushTask, bopts table.Options)

Source from the content-addressed store, hash-verified

970
971// buildL0Table builds a new table from the memtable.
972func buildL0Table(ft flushTask, bopts table.Options) []byte {
973 iter := ft.mt.NewIterator()
974 defer iter.Close()
975 b := table.NewTableBuilder(bopts)
976 defer b.Close()
977 var vp valuePointer
978 for iter.SeekToFirst(); iter.Valid(); iter.Next() {
979 if len(ft.dropPrefixes) > 0 && hasAnyPrefixes(iter.Key(), ft.dropPrefixes) {
980 continue
981 }
982 vs := iter.Value()
983 if vs.Meta&bitValuePointer > 0 {
984 vp.Decode(vs.Value)
985 }
986 b.Add(iter.Key(), iter.Value(), vp.Len)
987 }
988 return b.Finish()
989}
990
991type flushTask struct {
992 mt *skl.Skiplist

Callers 1

handleFlushTaskMethod · 0.85

Calls 13

CloseMethod · 0.95
SeekToFirstMethod · 0.95
ValidMethod · 0.95
NextMethod · 0.95
KeyMethod · 0.95
ValueMethod · 0.95
DecodeMethod · 0.95
NewTableBuilderFunction · 0.92
hasAnyPrefixesFunction · 0.85
CloseMethod · 0.65
NewIteratorMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…