MCPcopy
hub / github.com/thanos-io/thanos / IndexCache

Interface IndexCache

pkg/store/cache/cache.go:44–64  ·  view source on GitHub ↗

IndexCache is the interface exported by index cache backends. Store operations do not support context.Context, deadlines need to be supported by the backends themselves. This is because Set operations are run async and it does not make sense to attach same context (potentially with a deadline) as in

Source from the content-addressed store, hash-verified

42// run async and it does not make sense to attach same context
43// (potentially with a deadline) as in the original user's request.
44type IndexCache interface {
45 // StorePostings stores postings for a single series.
46 StorePostings(blockID ulid.ULID, l labels.Label, v []byte, tenant string)
47
48 // FetchMultiPostings fetches multiple postings - each identified by a label -
49 // and returns a map containing cache hits, along with a list of missing keys.
50 FetchMultiPostings(ctx context.Context, blockID ulid.ULID, keys []labels.Label, tenant string) (hits map[labels.Label][]byte, misses []labels.Label)
51
52 // StoreExpandedPostings stores expanded postings for a set of label matchers.
53 StoreExpandedPostings(blockID ulid.ULID, matchers []*labels.Matcher, v []byte, tenant string)
54
55 // FetchExpandedPostings fetches expanded postings and returns cached data and a boolean value representing whether it is a cache hit or not.
56 FetchExpandedPostings(ctx context.Context, blockID ulid.ULID, matchers []*labels.Matcher, tenant string) ([]byte, bool)
57
58 // StoreSeries stores a single series.
59 StoreSeries(blockID ulid.ULID, id storage.SeriesRef, v []byte, tenant string)
60
61 // FetchMultiSeries fetches multiple series - each identified by ID - from the cache
62 // and returns a map containing cache hits, along with a list of missing IDs.
63 FetchMultiSeries(ctx context.Context, blockID ulid.ULID, ids []storage.SeriesRef, tenant string) (hits map[storage.SeriesRef][]byte, misses []storage.SeriesRef)
64}
65
66// Common metrics that should be used by all cache implementations.
67type CommonMetrics struct {

Callers 36

StorePostingsMethod · 0.65
fetchPostingsMethod · 0.65
StorePostingsMethod · 0.65
StorePostingsMethod · 0.65
FetchMultiPostingsMethod · 0.65
fetchPostingsMethod · 0.65
FetchMultiPostingsMethod · 0.65
FetchMultiPostingsMethod · 0.65

Implementers 6

swappableCachepkg/store/bucket_e2e_test.go
noopCachepkg/store/bucket.go
TracingIndexCachepkg/store/cache/tracing_index_cache.go
FilteredIndexCachepkg/store/cache/filter_cache.go
InMemoryIndexCachepkg/store/cache/inmemory.go
RemoteIndexCachepkg/store/cache/memcached.go

Calls

no outgoing calls

Tested by

no test coverage detected