caching

package
v0.0.0-...-3de6a8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// This query collects untriaged image digests within the specified commit window for the given
	// corpus where an ignore rule is not applied. This data is used when the user wants to see
	// a list of untriaged digests for the specific corpus in the UI.
	ByBlameQuery = `` /* 533-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func ByBlameKey

func ByBlameKey(corpus string) string

func JoinedTracesStatement

func JoinedTracesStatement(filters []common.FilterSets, corpus string, isSpanner bool) string

JoinedTracesStatement returns a SQL snippet that includes a WITH table called JoinedTraces. This table contains just the trace_ids that match the given filters. filters is expected to have keys which passed sanitization (it will sanitize the values). The snippet will include other tables that will be unioned and intersected to create the appropriate rows. This is similar to the technique we use for ignore rules, chosen to maximize consistent performance by using the inverted key index. The keys and values are hardcoded into the string instead of being passed in as arguments because kjlubick@ was not able to use the placeholder values to compare JSONB types removed from a JSONB object to a string while still using the indexes.

func MatchingIgnoredTracesKey

func MatchingIgnoredTracesKey(corpus string) string

MatchingIgnoredTracesKey returns a key to be used to cache the data for ignored traces.

func MatchingNegativeTracesKey

func MatchingNegativeTracesKey(corpus string) string

MatchingNegativeTracesKey returns a key to be used to cache the data for negative traces.

func MatchingPositiveTracesKey

func MatchingPositiveTracesKey(corpus string) string

MatchingPositiveTracesKey returns a key to be used to cache the data for positive traces.

func MatchingUntriagedTracesKey

func MatchingUntriagedTracesKey(corpus string) string

MatchingUntriagedTracesKey returns a key to be used to cache the data for untriaged traces.

func NewByBlameCacheDataProvider

func NewByBlameCacheDataProvider(db *pgxpool.Pool, corpora []string, commitWindow int, sqlQuery string, cacheKeyFunc func(string) string) cacheDataProvider

NewByBlameCacheDataProvider returns a new instance of the cacheDataProvider struct.

func NewMatchingTracesCacheDataProvider

func NewMatchingTracesCacheDataProvider(db *pgxpool.Pool, corpora []string, commitWindow int) *matchingTracesCacheDataProvider

NewMatchingTracesCacheDataProvider returns a new instance of the matchingTracesCacheDataProvider.

Types

type MatchingTracesQueryContext

type MatchingTracesQueryContext struct {
	IncludeUntriaged                 bool
	IncludeNegative                  bool
	IncludePositive                  bool
	IncludeIgnored                   bool
	OnlyIncludeDigestsProducedAtHead bool
	Corpus                           string
	TraceValues                      paramtools.ParamSet
}

MatchingTracesQueryContext provides a struct representing the search query.

type SearchCacheData

type SearchCacheData struct {
	TraceID    schema.TraceID     `json:"traceID"`
	GroupingID schema.GroupingID  `json:"groupingID"`
	Digest     schema.DigestBytes `json:"digest"`
}

SearchCacheData provides a struct to hold data for the entry in by blame cache.

type SearchCacheManager

type SearchCacheManager struct {
	// contains filtered or unexported fields
}

SearchCacheManager provides a struct to handle the cache operations for gold search.

func New

func New(cacheClient cache.Cache, db *pgxpool.Pool, corpora []string, commitWindow int) *SearchCacheManager

New returns a new instance of the SearchCacheManager.

func (SearchCacheManager) GetByBlameData

func (s SearchCacheManager) GetByBlameData(ctx context.Context, firstCommitId string, corpus string) ([]SearchCacheData, error)

GetByBlameData returns the by blame data for the given corpus from cache.

func (SearchCacheManager) GetMatchingDigestsAndTraces

func (s SearchCacheManager) GetMatchingDigestsAndTraces(ctx context.Context, searchQueryContext MatchingTracesQueryContext) ([]common.DigestWithTraceAndGrouping, error)

GetMatchingDigestsAndTraces returns the digests and traces for the given search query from the cache.

Note: On a cache miss it returns nil object.

func (SearchCacheManager) RunCachePopulation

func (s SearchCacheManager) RunCachePopulation(ctx context.Context) error

RunCachePopulation gets the cache data from the providers and stores it in the cache instance.

func (SearchCacheManager) SetDatabaseType

func (s SearchCacheManager) SetDatabaseType(dbType config.DatabaseType)

SetDatabaseType sets the database type for the current configuration.

func (*SearchCacheManager) SetPublicTraces

func (s *SearchCacheManager) SetPublicTraces(traces map[schema.MD5Hash]struct{})

SetPublicTraces sets the given traces as the publicly visible ones.

type SearchCacheType

type SearchCacheType int
const (
	// ByBlame_Corpus denotes the cache type for untriaged images by commits for a given corpus.
	ByBlame_Corpus SearchCacheType = iota
	// MatchingTraces denotes the cache type for search results.
	MatchingTraces
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL