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

Function getIDMap

util.go:97–112  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

95}
96
97func getIDMap(dir string) map[uint64]struct{} {
98 fileInfos, err := ioutil.ReadDir(dir)
99 y.Check(err)
100 idMap := make(map[uint64]struct{})
101 for _, info := range fileInfos {
102 if info.IsDir() {
103 continue
104 }
105 fileID, ok := table.ParseFileID(info.Name())
106 if !ok {
107 continue
108 }
109 idMap[fileID] = struct{}{}
110 }
111 return idMap
112}
113
114func init() {
115 rand.Seed(time.Now().UnixNano())

Callers 2

TestLoadFunction · 0.85
newLevelsControllerFunction · 0.85

Calls 2

CheckFunction · 0.92
ParseFileIDFunction · 0.92

Tested by 1

TestLoadFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…