MCPcopy
hub / github.com/grafana/tempo / determineBlockIDs

Method determineBlockIDs

modules/blockbuilder/tenant_store.go:250–273  ·  view source on GitHub ↗
(ctx context.Context, r tempodb.Reader)

Source from the content-addressed store, hash-verified

248}
249
250func (s *tenantStore) determineBlockIDs(ctx context.Context, r tempodb.Reader) (nextID backend.UUID, existingBlocksToBeCompacted []backend.UUID, err error) {
251 for {
252 nextID = s.idGenerator.NewID()
253
254 meta, compactedMeta, err := r.BlockMeta(ctx, s.tenantID, nextID)
255 if err != nil {
256 return backend.UUID{}, nil, err
257 }
258
259 if compactedMeta != nil {
260 // This ID is already in use but does not need to be compacted again
261 continue
262 }
263
264 if meta != nil {
265 // This ID is already in use and needs to be compacted
266 existingBlocksToBeCompacted = append(existingBlocksToBeCompacted, nextID)
267 continue
268 }
269
270 // This block is available
271 return nextID, existingBlocksToBeCompacted, nil
272 }
273}

Callers 1

FlushMethod · 0.95

Calls 2

NewIDMethod · 0.65
BlockMetaMethod · 0.65

Tested by

no test coverage detected