indexer

package
v0.0.0-...-33de393 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package indexer continuously creates an index of the test results as the tiles, expectations, and ignores change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangelistIndex

type ChangelistIndex struct {
	// LatestPatchset is the most recent Patchset that was seen for this CL (and that the rest of
	// the data in the index belongs to).
	LatestPatchset tjstore.CombinedPSID
	// UntriagedResults is a map of all results that were untriaged the last time the index was built.
	UntriagedResults []tjstore.TryJobResult

	// ParamSet is a set of all keys seen in trace data for this CL, as well as any values associated
	// with those keys. A best effort is made to include Params from all Patchsets on this CL.
	ParamSet paramtools.ParamSet

	// ComputedTS is when this index was created. This helps clients determine how fresh the data is.
	ComputedTS time.Time
}

ChangelistIndex is an index about data seen for the most recent Patchset of a given Changelist. We only keep the most recent Patchset around because that's the data that is most likely to be searched by a user.

func (*ChangelistIndex) Copy

func (c *ChangelistIndex) Copy() *ChangelistIndex

Copy returns a deep copy of the ChangelistIndex.

type IndexSearcher

type IndexSearcher interface {
	// Tile returns the current complex tile from which simpler tiles, like one without ignored
	// traces, can be retrieved
	Tile() tiling.ComplexTile

	// GetIgnoreMatcher returns a matcher for the ignore rules that were used to
	// build the tile with ignores.
	GetIgnoreMatcher() paramtools.ParamMatcher

	// DigestCountsByTest returns the counts of digests grouped by test name.
	DigestCountsByTest(is types.IgnoreState) map[types.TestName]digest_counter.DigestCount

	// MaxDigestsByTest returns the digests per test that were seen the most.
	MaxDigestsByTest(is types.IgnoreState) map[types.TestName]types.DigestSet

	// DigestCountsByTrace returns the counts of digests grouped by trace id.
	DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount

	// DigestCountsByQuery returns a DigestCount of all the digests that match the given query.
	DigestCountsByQuery(query paramtools.ParamSet, is types.IgnoreState) digest_counter.DigestCount

	// GetSummaries returns all summaries that were computed for this index.
	GetSummaries(is types.IgnoreState) []*summary.TriageStatus

	// SummarizeByGrouping returns those summaries from a given corpus that match the given inputs.
	// They may be filtered by any of: query, is at head or not.
	SummarizeByGrouping(ctx context.Context, corpus string, query paramtools.ParamSet, is types.IgnoreState, head bool) ([]*summary.TriageStatus, error)

	// GetParamsetSummary Returns the ParamSetSummary that matches the given test/digest.
	GetParamsetSummary(test types.TestName, digest types.Digest, is types.IgnoreState) paramtools.ParamSet

	// GetParamsetSummaryByTest returns all ParamSetSummaries in this tile grouped by test name.
	GetParamsetSummaryByTest(is types.IgnoreState) map[types.TestName]map[types.Digest]paramtools.ParamSet

	// GetBlame returns the blame computed for the given test/digest.
	GetBlame(test types.TestName, digest types.Digest, commits []tiling.Commit) blame.BlameDistribution

	// SlicedTraces returns a slice of TracePairs that match the query and the ignore state.
	// This is meant to be a partial slice, as only the corpus and testname from the query are
	// used to create the subslice.
	SlicedTraces(is types.IgnoreState, query map[string][]string) []*tiling.TracePair

	// MostRecentPositiveDigest returns the most recent positive digest for the given trace.
	MostRecentPositiveDigest(ctx context.Context, traceID tiling.TraceID) (types.Digest, error)
}

type IndexSource

type IndexSource interface {
	// GetIndex returns an IndexSearcher, which can be considered immutable (the underlying
	// Tile won't change). It should be used to handle an entire request to provide
	// consistent information.
	GetIndex() IndexSearcher

	// GetIndexForCL returns an index object for a given Changelist.
	GetIndexForCL(crs, clID string) *ChangelistIndex
}

type Indexer

type Indexer struct {
	IndexerConfig
	// contains filtered or unexported fields
}

Indexer is the type that continuously processes data as the underlying data change. It uses a DAG that encodes the dependencies of the different components of an index and creates a processing pipeline on top of it.

func New

func New(ctx context.Context, ic IndexerConfig, interval time.Duration) (*Indexer, error)

New returns a new IndexSource instance. It synchronously indexes the initially available tile. If the indexing fails an error is returned. The provided interval defines how often the index should be refreshed.

func (*Indexer) GetIndex

func (ix *Indexer) GetIndex() IndexSearcher

GetIndex implements the IndexSource interface.

func (*Indexer) GetIndexForCL

func (ix *Indexer) GetIndexForCL(crs, clID string) *ChangelistIndex

GetIndexForCL implements the IndexSource interface.

type IndexerConfig

type IndexerConfig struct {
	ExpChangeListener expectations.ChangeEventRegisterer
	DiffWorkPublisher diff.Calculator
	ExpectationsStore expectations.Store
	GCSClient         storage.GCSClient
	ReviewSystems     []clstore.ReviewSystem
	TileSource        tilesource.TileSource
	TryJobStore       tjstore.Store
}

type SearchIndex

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

SearchIndex contains everything that is necessary to search our current knowledge about test results. It should be considered as immutable. Whenever the underlying data changes, a new index is calculated via a pdag.

func SearchIndexForTesting

func SearchIndexForTesting(cpxTile tiling.ComplexTile, dc [2]digest_counter.DigestCounter, pm [2]paramsets.ParamSummary, exp expectations.Store, b blame.Blamer) (*SearchIndex, error)

SearchIndexForTesting returns filled in search index to be used when testing. Note that the indices of the arrays are the int values of types.IgnoreState

func (*SearchIndex) DigestCountsByQuery

func (idx *SearchIndex) DigestCountsByQuery(query paramtools.ParamSet, is types.IgnoreState) digest_counter.DigestCount

DigestCountsByQuery implements the IndexSearcher interface.

func (*SearchIndex) DigestCountsByTest

func (idx *SearchIndex) DigestCountsByTest(is types.IgnoreState) map[types.TestName]digest_counter.DigestCount

DigestCountsByTest implements the IndexSearcher interface.

func (*SearchIndex) DigestCountsByTrace

func (idx *SearchIndex) DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount

DigestCountsByTrace implements the IndexSearcher interface.

func (*SearchIndex) GetBlame

func (idx *SearchIndex) GetBlame(test types.TestName, digest types.Digest, commits []tiling.Commit) blame.BlameDistribution

GetBlame implements the IndexSearcher interface.

func (*SearchIndex) GetIgnoreMatcher

func (idx *SearchIndex) GetIgnoreMatcher() paramtools.ParamMatcher

GetIgnoreMatcher implements the IndexSearcher interface.

func (*SearchIndex) GetParamsetSummary

func (idx *SearchIndex) GetParamsetSummary(test types.TestName, digest types.Digest, is types.IgnoreState) paramtools.ParamSet

GetParamsetSummary implements the IndexSearcher interface.

func (*SearchIndex) GetParamsetSummaryByTest

func (idx *SearchIndex) GetParamsetSummaryByTest(is types.IgnoreState) map[types.TestName]map[types.Digest]paramtools.ParamSet

GetParamsetSummaryByTest implements the IndexSearcher interface.

func (*SearchIndex) GetSummaries

func (idx *SearchIndex) GetSummaries(is types.IgnoreState) []*summary.TriageStatus

GetSummaries implements the IndexSearcher interface.

func (*SearchIndex) MaxDigestsByTest

func (idx *SearchIndex) MaxDigestsByTest(is types.IgnoreState) map[types.TestName]types.DigestSet

MaxDigestsByTest implements the IndexSearcher interface.

func (*SearchIndex) MostRecentPositiveDigest

func (idx *SearchIndex) MostRecentPositiveDigest(ctx context.Context, traceID tiling.TraceID) (types.Digest, error)

MostRecentPositiveDigest implements the IndexSearcher interface.

func (*SearchIndex) SlicedTraces

func (idx *SearchIndex) SlicedTraces(is types.IgnoreState, query map[string][]string) []*tiling.TracePair

SlicedTraces returns a slice of TracePairs that match the query and the ignore state. This is meant to be a superset of traces, as only the corpus and testname from the query are used for this pre-filter step.

func (*SearchIndex) SummarizeByGrouping

func (idx *SearchIndex) SummarizeByGrouping(ctx context.Context, corpus string, query paramtools.ParamSet, is types.IgnoreState, head bool) ([]*summary.TriageStatus, error)

SummarizeByGrouping implements the IndexSearcher interface.

func (*SearchIndex) Tile

func (idx *SearchIndex) Tile() tiling.ComplexTile

Tile implements the IndexSearcher interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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