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
| 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. |
| 44 | type 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. |
| 67 | type CommonMetrics struct { |
no outgoing calls
no test coverage detected