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

Method ClearBlock

tempodb/backend/gcs/compactor.go:42–79  ·  view source on GitHub ↗
(blockID uuid.UUID, tenantID string)

Source from the content-addressed store, hash-verified

40}
41
42func (rw *readerWriter) ClearBlock(blockID uuid.UUID, tenantID string) error {
43 if len(tenantID) == 0 {
44 return fmt.Errorf("empty tenant id")
45 }
46
47 if blockID == uuid.Nil {
48 return fmt.Errorf("empty block id")
49 }
50
51 ctx := context.TODO()
52 iter := rw.bucket.Objects(ctx, &storage.Query{
53 Prefix: backend.RootPath(blockID, tenantID, rw.cfg.Prefix),
54 Versions: false,
55 })
56
57 for {
58 attrs, err := iter.Next()
59 if errors.Is(err, iterator.Done) {
60 break
61 }
62 if err != nil {
63 return err
64 }
65
66 o := rw.bucket.Object(attrs.Name).Retryer(
67 storage.WithBackoff(gax.Backoff{}),
68 storage.WithPolicy(storage.RetryAlways),
69 storage.WithMaxAttempts(rw.cfg.MaxRetries),
70 )
71
72 err = o.Delete(ctx)
73 if err != nil {
74 return err
75 }
76 }
77
78 return nil
79}
80
81func (rw *readerWriter) CompactedBlockMeta(blockID uuid.UUID, tenantID string) (*backend.CompactedBlockMeta, error) {
82 name := backend.CompactedMetaFileName(blockID, tenantID, rw.cfg.Prefix)

Callers

nothing calls this directly

Calls 3

RootPathFunction · 0.92
NextMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected