MCPcopy Create free account
hub / github.com/coder/coder / Snapshot

Method Snapshot

agent/filefinder/delta.go:107–125  ·  view source on GitHub ↗

Snapshot returns a frozen read-only view of the index.

()

Source from the content-addressed store, hash-verified

105
106// Snapshot returns a frozen read-only view of the index.
107func (idx *Index) Snapshot() *Snapshot {
108 del := make(map[uint32]bool, len(idx.deleted))
109 for id := range idx.deleted {
110 del[id] = true
111 }
112 var p1Copy [256][]uint32
113 for i, ids := range idx.byPrefix1 {
114 if len(ids) > 0 {
115 p1Copy[i] = ids[:len(ids):len(ids)]
116 }
117 }
118 return &Snapshot{
119 docs: idx.docs[:len(idx.docs):len(idx.docs)],
120 deleted: del,
121 byGram: copyPostings(idx.byGram),
122 byPrefix1: p1Copy,
123 byPrefix2: copyPostings(idx.byPrefix2),
124 }
125}

Callers 8

MakeTestSnapshotFunction · 0.95
TestIndex_SnapshotFunction · 0.95
publishSnapshotMethod · 0.80
BenchmarkSearch_ByScaleFunction · 0.80
BenchmarkDeltaUpdateFunction · 0.80
BenchmarkMemoryProfileFunction · 0.80

Calls 1

copyPostingsFunction · 0.85

Tested by 7

MakeTestSnapshotFunction · 0.76
TestIndex_SnapshotFunction · 0.76
BenchmarkSearch_ByScaleFunction · 0.64
BenchmarkDeltaUpdateFunction · 0.64
BenchmarkMemoryProfileFunction · 0.64