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

Method Find

tempodb/backend/s3/s3.go:505–543  ·  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

503
504// Find implements backend.Reader
505func (rw *readerWriter) Find(ctx context.Context, keypath backend.KeyPath, f backend.FindFunc) (err error) {
506 keypath = backend.KeyPathWithPrefix(keypath, rw.cfg.Prefix)
507 prefix := path.Join(keypath...)
508
509 if len(prefix) > 0 {
510 prefix += "/"
511 }
512
513 nextToken := ""
514 isTruncated := true
515 var res minio.ListBucketV2Result
516
517 for isTruncated {
518 select {
519 case <-ctx.Done():
520 return
521 default:
522 res, err = rw.core.ListObjectsV2(rw.cfg.Bucket, prefix, "", nextToken, "", 0)
523 if err != nil {
524 return fmt.Errorf("error finding objects in s3 bucket, bucket: %s: %w", rw.cfg.Bucket, err)
525 }
526
527 isTruncated = res.IsTruncated
528 nextToken = res.NextContinuationToken
529
530 if len(res.Contents) > 0 {
531 for _, c := range res.Contents {
532 opts := backend.FindMatch{
533 Key: strings.TrimPrefix(c.Key, rw.cfg.Prefix),
534 Modified: c.LastModified,
535 }
536 f(opts)
537 }
538 }
539 }
540 }
541
542 return
543}
544
545// Read implements backend.Reader
546func (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
DoneMethod · 0.65

Tested by

no test coverage detected