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

Method Find

tempodb/backend/gcs/gcs.go:330–360  ·  view source on GitHub ↗

Find implements backend.Reader

(ctx context.Context, keypath backend.KeyPath, f backend.FindFunc)

Source from the content-addressed store, hash-verified

328
329// Find implements backend.Reader
330func (rw *readerWriter) Find(ctx context.Context, keypath backend.KeyPath, f backend.FindFunc) (err error) {
331 keypath = backend.KeyPathWithPrefix(keypath, rw.cfg.Prefix)
332 prefix := path.Join(keypath...)
333 if len(prefix) > 0 {
334 prefix += "/"
335 }
336
337 iter := rw.bucket.Objects(ctx, &storage.Query{
338 Delimiter: "",
339 Prefix: prefix,
340 Versions: false,
341 })
342
343 for {
344 attrs, iterErr := iter.Next()
345 if errors.Is(iterErr, iterator.Done) {
346 break
347 }
348 if iterErr != nil {
349 return fmt.Errorf("iterating objects: %w", err)
350 }
351
352 opts := backend.FindMatch{
353 Key: strings.TrimPrefix(attrs.Name, rw.cfg.Prefix),
354 Modified: attrs.Updated,
355 }
356 f(opts)
357 }
358
359 return
360}
361
362// Read implements backend.Reader
363func (rw *readerWriter) Read(ctx context.Context, name string, keypath backend.KeyPath, _ *backend.CacheInfo) (io.ReadCloser, int64, error) {

Callers

nothing calls this directly

Calls 4

KeyPathWithPrefixFunction · 0.92
fFunction · 0.85
JoinMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected