MCPcopy Create free account
hub / github.com/evilsocket/sum / LoadRecords

Function LoadRecords

storage/records.go:19–34  ·  view source on GitHub ↗

LoadRecords loads and indexes raw protobuf records from the data files found in a given path.

(dataPath string)

Source from the content-addressed store, hash-verified

17// LoadRecords loads and indexes raw protobuf records from
18// the data files found in a given path.
19func LoadRecords(dataPath string) (*Records, error) {
20 recs := &Records{
21 Index: WithDriver(dataPath, RecordDriver{}),
22 metaBy: make(map[string]metaIndex),
23 }
24
25 if err := recs.Load(); err != nil {
26 return nil, err
27 }
28
29 for _, m := range recs.index {
30 recs.metaIndexCreate(m.(*pb.Record))
31 }
32
33 return recs, nil
34}
35
36func (r *Records) metaIndexCreate(rec *pb.Record) {
37 r.Lock()

Callers 11

BenchmarkRecordsFindFunction · 0.85
BenchmarkRecordsUpdateFunction · 0.85
BenchmarkRecordsDeleteFunction · 0.85
setupRecordsFunction · 0.85
TestLoadRecordsFunction · 0.85
TestRecordsFindFunction · 0.85
TestRecordsUpdateFunction · 0.85
TestRecordsDeleteFunction · 0.85

Calls 3

metaIndexCreateMethod · 0.95
WithDriverFunction · 0.85
LoadMethod · 0.80

Tested by 11

BenchmarkRecordsFindFunction · 0.68
BenchmarkRecordsUpdateFunction · 0.68
BenchmarkRecordsDeleteFunction · 0.68
setupRecordsFunction · 0.68
TestLoadRecordsFunction · 0.68
TestRecordsFindFunction · 0.68
TestRecordsUpdateFunction · 0.68
TestRecordsDeleteFunction · 0.68