MCPcopy Create free account
hub / github.com/cortexproject/cortex / BucketScanBlocksFinder

Struct BucketScanBlocksFinder

pkg/querier/blocks_finder_bucket_scan.go:54–77  ·  view source on GitHub ↗

BucketScanBlocksFinder is a BlocksFinder implementation periodically scanning the bucket to discover blocks.

Source from the content-addressed store, hash-verified

52
53// BucketScanBlocksFinder is a BlocksFinder implementation periodically scanning the bucket to discover blocks.
54type BucketScanBlocksFinder struct {
55 services.Service
56
57 cfg BucketScanBlocksFinderConfig
58 cfgProvider bucket.TenantConfigProvider
59 logger log.Logger
60 bucketClient objstore.Bucket
61 fetchersMetrics *storegateway.MetadataFetcherMetrics
62 usersScanner users.Scanner
63
64 // We reuse the metadata fetcher instance for a given tenant both because of performance
65 // reasons (the fetcher keeps a in-memory cache) and being able to collect and group metrics.
66 fetchersMx sync.Mutex
67 fetchers map[string]userFetcher
68
69 // Keep the per-tenant/user metas found during the last run.
70 userMx sync.RWMutex
71 userMetas map[string]bucketindex.Blocks
72 userMetasLookup map[string]map[ulid.ULID]*bucketindex.Block
73 userDeletionMarks map[string]map[ulid.ULID]*bucketindex.BlockDeletionMark
74
75 scanDuration prometheus.Histogram
76 scanLastSuccess prometheus.Gauge
77}
78
79func NewBucketScanBlocksFinder(cfg BucketScanBlocksFinderConfig, usersScanner users.Scanner, bucketClient objstore.InstrumentedBucket, cfgProvider bucket.TenantConfigProvider, logger log.Logger, reg prometheus.Registerer) *BucketScanBlocksFinder {
80 d := &BucketScanBlocksFinder{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected