Documentation
¶
Index ¶
- Constants
- func ByBlameKey(corpus string) string
- func JoinedTracesStatement(filters []common.FilterSets, corpus string, isSpanner bool) string
- func MatchingIgnoredTracesKey(corpus string) string
- func MatchingNegativeTracesKey(corpus string) string
- func MatchingPositiveTracesKey(corpus string) string
- func MatchingUntriagedTracesKey(corpus string) string
- func NewByBlameCacheDataProvider(db *pgxpool.Pool, corpora []string, commitWindow int, sqlQuery string, ...) cacheDataProvider
- func NewMatchingTracesCacheDataProvider(db *pgxpool.Pool, corpora []string, commitWindow int) *matchingTracesCacheDataProvider
- type MatchingTracesQueryContext
- type SearchCacheData
- type SearchCacheManager
- func (s SearchCacheManager) GetByBlameData(ctx context.Context, firstCommitId string, corpus string) ([]SearchCacheData, error)
- func (s SearchCacheManager) GetMatchingDigestsAndTraces(ctx context.Context, searchQueryContext MatchingTracesQueryContext) ([]common.DigestWithTraceAndGrouping, error)
- func (s SearchCacheManager) RunCachePopulation(ctx context.Context) error
- func (s SearchCacheManager) SetDatabaseType(dbType config.DatabaseType)
- func (s *SearchCacheManager) SetPublicTraces(traces map[schema.MD5Hash]struct{})
- type SearchCacheType
Constants ¶
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 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 ¶
MatchingIgnoredTracesKey returns a key to be used to cache the data for ignored traces.
func MatchingNegativeTracesKey ¶
MatchingNegativeTracesKey returns a key to be used to cache the data for negative traces.
func MatchingPositiveTracesKey ¶
MatchingPositiveTracesKey returns a key to be used to cache the data for positive traces.
func MatchingUntriagedTracesKey ¶
MatchingUntriagedTracesKey returns a key to be used to cache the data for untriaged traces.
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 )