MCPcopy Index your code
hub / github.com/git-bug/git-bug / Build

Method Build

cache/subcache.go:189–320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189func (sc *SubCache[EntityT, ExcerptT, CacheT]) Build() <-chan BuildEvent {
190 // value chosen experimentally as giving the fasted indexing, while
191 // not driving the cache size on disk too high.
192 //
193 // | batchCount | bugIndex (MB) | idIndex (kB) | time (s) |
194 // |:----------:|:-------------:|:------------:|:--------:|
195 // | 10 | 24 | 84 | 1,59 |
196 // | 30 | 26 | 84 | 1,388 |
197 // | 50 | 26 | 84 | 1,44 |
198 // | 60 | 26 | 80 | 1,377 |
199 // | 68 | 27 | 80 | 1,385 |
200 // | 75 | 26 | 84 | 1,32 |
201 // | 80 | 26 | 80 | 1,37 |
202 // | 85 | 27 | 80 | 1,317 |
203 // | 100 | 26 | 80 | 1,455 |
204 // | 150 | 26 | 80 | 2,066 |
205 // | 200 | 28 | 80 | 2,885 |
206 // | 250 | 30 | 72 | 3,555 |
207 // | 300 | 31 | 72 | 4,787 |
208 // | 500 | 23 | 72 | 5,4 |
209 const maxBatchCount = 75
210
211 out := make(chan BuildEvent)
212
213 go func() {
214 defer close(out)
215
216 out <- BuildEvent{
217 Typename: sc.typename,
218 Event: BuildEventStarted,
219 }
220
221 sc.excerpts = make(map[entity.Id]ExcerptT)
222
223 allEntities := sc.actions.ReadAllWithResolver(sc.repo, sc.resolvers())
224
225 index, err := sc.repo.GetIndex(sc.namespace)
226 if err != nil {
227 out <- BuildEvent{
228 Typename: sc.typename,
229 Err: err,
230 }
231 return
232 }
233
234 // wipe the index just to be sure
235 err = index.Clear()
236 if err != nil {
237 out <- BuildEvent{
238 Typename: sc.typename,
239 Err: err,
240 }
241 return
242 }
243
244 indexer, indexEnd := index.IndexBatch()
245 var batchCount int
246

Callers

nothing calls this directly

Calls 7

writeMethod · 0.95
closeFunction · 0.85
GetIndexMethod · 0.65
ClearMethod · 0.65
IndexBatchMethod · 0.65
IdMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected