providers

package
v0.0.0-...-da114dc Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	UnignoredRecentTracesView = "traces"
	ByBlameView               = "byblame"
)

Variables

This section is empty.

Functions

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.

Types

type ChangelistProvider

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

ChangelistProvider provides a struct for get changelist related data for search.

func NewChangelistProvider

func NewChangelistProvider(db *pgxpool.Pool) *ChangelistProvider

NewChangelistProvider returns a new instance of the ChangelistProvider.

func (*ChangelistProvider) GetNewAndUntriagedSummaryForCL

func (s *ChangelistProvider) GetNewAndUntriagedSummaryForCL(ctx context.Context, clID string) ([]PatchsetNewAndUntriagedSummary, error)

GetNewAndUntriagedSummaryForCL returns the new and untriaged patchset summaries for the given CL.

func (*ChangelistProvider) SetDigestsOnPrimary

func (s *ChangelistProvider) SetDigestsOnPrimary(digestsOnPrimary map[common.GroupingDigestKey]struct{})

SetDigestsOnPrimary sets the primary digest cache on the provider.

type CommitsProvider

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

CommitsProvider provides a struct for retrieving commit related data.

func NewCommitsProvider

func NewCommitsProvider(db *pgxpool.Pool, cacheClient cache.Cache, windowLength int) *CommitsProvider

NewCommitsProvider returns a new instance of CommitsProvider.

func (*CommitsProvider) GetCommits

func (s *CommitsProvider) GetCommits(ctx context.Context) ([]frontend.Commit, error)

GetCommits returns the front-end friendly version of the commits within the searched window.

func (*CommitsProvider) GetCommitsInWindow

func (s *CommitsProvider) GetCommitsInWindow(ctx context.Context) ([]frontend.Commit, error)

GetCommitsInWindow implements the API interface

func (*CommitsProvider) PopulateCommitCache

func (s *CommitsProvider) PopulateCommitCache(ctx context.Context) error

PopulateCommitCache retrieves commits in the current window and adds them to the configured cache for the instance.

type MaterializedViewProvider

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

MaterializedViewProvider provides a struct for running materialized view related operations.

func NewMaterializedViewProvider

func NewMaterializedViewProvider(db *pgxpool.Pool, windowLength int) *MaterializedViewProvider

NewMaterializedViewProvider returns a new instance of the MaterializedViewProvider.

func (*MaterializedViewProvider) GetMaterializedView

func (s *MaterializedViewProvider) GetMaterializedView(viewName, corpus string) string

GetMaterializedView returns the name of the materialized view if it has been created, or empty string if there is not such a view.

func (*MaterializedViewProvider) StartMaterializedViews

func (s *MaterializedViewProvider) StartMaterializedViews(ctx context.Context, corpora []string, updateInterval time.Duration) error

StartMaterializedViews creates materialized views for non-ignored traces belonging to the given corpora. It starts a goroutine to keep these up to date.

type PatchsetNewAndUntriagedSummary

type PatchsetNewAndUntriagedSummary struct {
	// NewImages is the number of new images (digests) that were produced by this patchset by
	// non-ignored traces and not seen on the primary branch.
	NewImages int
	// NewUntriagedImages is the number of NewImages which are still untriaged. It is less than or
	// equal to NewImages.
	NewUntriagedImages int
	// TotalUntriagedImages is the number of images produced by this patchset by non-ignored traces
	// that are untriaged. This includes images that are untriaged and observed on the primary
	// branch (i.e. might not be the fault of this CL/PS). It is greater than or equal to
	// NewUntriagedImages.
	TotalUntriagedImages int
	// PatchsetID is the nonqualified id of the patchset. This is usually a git hash.
	PatchsetID string
	// PatchsetOrder is represents the chronological order the patchsets are in. It starts at 1.
	PatchsetOrder int
}

PatchsetNewAndUntriagedSummary is the summary for a specific PS. It focuses on the untriaged and new images produced.

type StatusProvider

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

StatusProvider provides a struct for retrieving status information on the corpora for the instance.

func NewStatusProvider

func NewStatusProvider(db *pgxpool.Pool, windowLength int) *StatusProvider

NewStatusProvider returns a new instance of the StatusProvider.

func (*StatusProvider) GetStatusForAllCorpora

func (s *StatusProvider) GetStatusForAllCorpora(ctx context.Context, isPublic bool) (frontend.Commit, []frontend.GUICorpusStatus, error)

GetStatusForAllCorpora returns the status information for all corpora.

func (*StatusProvider) SetPublicCorpora

func (s *StatusProvider) SetPublicCorpora(corpora map[string]struct{})

SetPublicCorpora sets the given corpora as the publicly visble ones.

func (*StatusProvider) SetPublicTraces

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

SetPublicTraces sets the given traces as the publicly visible ones.

type TraceDigestsProvider

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

TraceDigestsProvider provides a struct to retrieve trace and digests information for search.

func NewTraceDigestsProvider

func NewTraceDigestsProvider(db *pgxpool.Pool, windowLength int, materializedViewProvider *MaterializedViewProvider, cacheManager *caching.SearchCacheManager) *TraceDigestsProvider

NewTraceDigestsProvider returns a new instance of TraceDigestsProvider.

func (*TraceDigestsProvider) GetMatchingDigestsAndTraces

func (s *TraceDigestsProvider) GetMatchingDigestsAndTraces(ctx context.Context, includeUntriagedDigests, includeNegativeDigests, includePositiveDigests bool) ([]common.DigestWithTraceAndGrouping, error)

getMatchingDigestsAndTraces returns the tuples of digest+traceID that match the given query. The order of the result is arbitrary.

func (*TraceDigestsProvider) GetTracesForGroupingAndDigest

func (s *TraceDigestsProvider) GetTracesForGroupingAndDigest(ctx context.Context, grouping paramtools.Params, digest types.Digest) ([]common.DigestWithTraceAndGrouping, error)

GetTracesForGroupingAndDigest finds the traces on the primary branch which produced the given digest in the provided grouping. If no such trace exists (recently), a single result will be added with no trace, to all the UI to at least show the image and possible diff data.

func (*TraceDigestsProvider) GetTracesFromCLThatProduced

func (s *TraceDigestsProvider) GetTracesFromCLThatProduced(ctx context.Context, grouping paramtools.Params, digest types.Digest) ([]common.DigestWithTraceAndGrouping, error)

GetTracesFromCLThatProduced returns a common.DigestWithTraceAndGrouping for all traces that produced the provided digest in the given grouping on the most recent PS for the given CL.

func (*TraceDigestsProvider) GetTracesWithUntriagedDigestsAtHead

func (s *TraceDigestsProvider) GetTracesWithUntriagedDigestsAtHead(ctx context.Context, corpus string) (map[common.GroupingDigestKey][]schema.TraceID, error)

getTracesWithUntriagedDigestsAtHead identifies all untriaged digests being produced at head within the current window and returns all traces responsible for that behavior, clustered by the digest+grouping at head. This clustering allows us to better identify the commit(s) that caused the change, even with sparse data.

func (*TraceDigestsProvider) SetDatabaseType

func (s *TraceDigestsProvider) SetDatabaseType(dbType config.DatabaseType)

SetDatabaseType sets the database type for the current configuration.

func (*TraceDigestsProvider) SetPublicTraces

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

SetPublicTraces sets the given traces as the publicly visible ones.

Jump to

Keyboard shortcuts

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