Documentation
¶
Index ¶
- Variables
- type CacheableWebFeaturesDataGetter
- type DataCacher
- type HTTPResultsGetter
- type JobArguments
- type ResultsDownloader
- type ResultsSummaryFile
- type ResultsSummaryFileV2
- type RunProcessor
- type RunsGetter
- type RunsProcessor
- type WPTJobProcessor
- type WPTRunProcessor
- type WPTRunsProcessor
- type WPTStatusAbbreviation
- type WebFeatureDataGetter
- type WebFeatureWPTScoreStorer
- type WebFeaturesDataGetter
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFailedToRequestResults indicates the request for results failed. ErrFailedToRequestResults = errors.New("failed to send request for results") // ErrResultsDownloadBadStatusCode indicates there was an unexpected status code. ErrResultsDownloadBadStatusCode = errors.New("unexpected status code when downloading results") // ErrFailedToParseResults indicates the results could not be parsed. ErrFailedToParseResults = errors.New("failed to parse results") )
Functions ¶
This section is empty.
Types ¶
type CacheableWebFeaturesDataGetter ¶
type CacheableWebFeaturesDataGetter struct {
// contains filtered or unexported fields
}
func NewCacheableWebFeaturesDataGetter ¶
func NewCacheableWebFeaturesDataGetter( client WebFeatureDataGetter, cache DataCacher[string, shared.WebFeaturesData]) *CacheableWebFeaturesDataGetter
NewCacheableWebFeaturesDataGetter returns a new CacheableWebFeaturesDataGetter, which implements caching behavior on top of an underlying WebFeatureDataGetter.
func (*CacheableWebFeaturesDataGetter) GetWebFeaturesData ¶
func (g *CacheableWebFeaturesDataGetter) GetWebFeaturesData( ctx context.Context, _ string) (shared.WebFeaturesData, error)
type DataCacher ¶
type HTTPResultsGetter ¶
type HTTPResultsGetter struct {
// contains filtered or unexported fields
}
HTTPResultsGetter is an implementation of the ResultsGetter interface. It contains the logic to retrieve the results for a given WPT Run from the http endpoint. This endpoint typically is a publicly accessible url to a GCP storage bucket.
func NewHTTPResultsGetter ¶
func NewHTTPResultsGetter() *HTTPResultsGetter
NewHTTPResultsGetter returns a new instance of HTTPResultsGetter.
func (HTTPResultsGetter) DownloadResults ¶
func (h HTTPResultsGetter) DownloadResults( ctx context.Context, url string) (ResultsSummaryFile, error)
nolint: ireturn
type JobArguments ¶
type JobArguments struct {
// contains filtered or unexported fields
}
func NewJobArguments ¶
func NewJobArguments(from time.Time, browser, channel string, pageSize int) JobArguments
NewJobArguments constructor to create JobArguments, encapsulating essential workflow parameters.
type ResultsDownloader ¶
type ResultsDownloader interface { // Returns a small interface ResultsSummaryFile that is later used to generate metrics for each feature. // TODO. once we start parsing multiple file types, we can revisit not returning an interface. DownloadResults(context.Context, string) (ResultsSummaryFile, error) }
ResultsDownloader will download the results for a given run. The url to download the results comes from the API to get runs.
type ResultsSummaryFile ¶
type ResultsSummaryFile interface {
Score(context.Context, *shared.WebFeaturesData) map[string]wptconsumertypes.WPTFeatureMetric
}
ResultsSummaryFile contains the results of a given file format.
type ResultsSummaryFileV2 ¶
type ResultsSummaryFileV2 map[string]query.SummaryResult
ResultsSummaryFileV2 is the representation of the v2 summary file. It is a copy of the `summary` type from wpt.fyi. https://github.com/web-platform-tests/wpt.fyi/blob/05ddddc52a6b95469131eac5e439af39cbd1200a/api/query/query.go#L30 TODO export Summary in the wpt.fyi project and use it here instead.
func (ResultsSummaryFileV2) Score ¶
func (s ResultsSummaryFileV2) Score( ctx context.Context, testToWebFeatures *shared.WebFeaturesData) map[string]wptconsumertypes.WPTFeatureMetric
Score calculates web feature metrics from a V2 results summary file. It ensures the file is in the expected format and uses web features data for the scoring logic.
type RunProcessor ¶
type RunsGetter ¶
type RunsGetter interface { GetRuns( ctx context.Context, from time.Time, runsPerPage int, browserName string, channelName string, ) (shared.TestRuns, error) }
RunsGetter represents the behavior to get all the runs up until the given date.
type RunsProcessor ¶
type WPTJobProcessor ¶
type WPTJobProcessor struct {
// contains filtered or unexported fields
}
func NewWPTJobProcessor ¶
func NewWPTJobProcessor(runsGetter RunsGetter, runsProcessor RunsProcessor) WPTJobProcessor
func (WPTJobProcessor) Process ¶
func (w WPTJobProcessor) Process( ctx context.Context, job JobArguments) error
type WPTRunProcessor ¶
type WPTRunProcessor struct {
// contains filtered or unexported fields
}
WPTRunProcessor contains all the steps for the workflow to consume wpt data of a particular WPT Run.
func NewWPTRunProcessor ¶
func NewWPTRunProcessor( resultsDownloader ResultsDownloader, webFeaturesDataGetter WebFeaturesDataGetter, scoreStorer WebFeatureWPTScoreStorer) *WPTRunProcessor
NewWPTRunProcessor constructs a WPTRunProcessor.
func (WPTRunProcessor) ProcessRun ¶
type WPTRunsProcessor ¶
type WPTRunsProcessor struct {
// contains filtered or unexported fields
}
WPTRunsProcessor contains all the steps for the workflow to process wpt data of multiple WPT runs.
func NewWPTRunsProcessor ¶
func NewWPTRunsProcessor(runProcessor RunProcessor) *WPTRunsProcessor
func (WPTRunsProcessor) ProcessRuns ¶
type WPTStatusAbbreviation ¶
type WPTStatusAbbreviation string
WPTStatusAbbreviation is an enumeration of the abbreivations from https://github.com/web-platform-tests/wpt.fyi/tree/main/api#results-summaries
const ( WPTStatusOK WPTStatusAbbreviation = "O" WPTStatusPass WPTStatusAbbreviation = "P" WPTStatusFail WPTStatusAbbreviation = "F" WPTStatusSkip WPTStatusAbbreviation = "S" WPTStatusError WPTStatusAbbreviation = "E" WPTStatusNotRun WPTStatusAbbreviation = "N" WPTStatusCrash WPTStatusAbbreviation = "C" WPTStatusTimeout WPTStatusAbbreviation = "T" WPTStatusPreconditionFailed WPTStatusAbbreviation = "PF" WPTStatusEmpty WPTStatusAbbreviation = "" )
type WebFeatureDataGetter ¶
type WebFeatureDataGetter interface {
Get(context.Context) (shared.WebFeaturesData, error)
}
WebFeatureDataGetter defines an interface for retrieving web features data from some underlying source.
type WebFeatureWPTScoreStorer ¶
type WebFeatureWPTScoreStorer interface { InsertWPTRun(context.Context, shared.TestRun) error UpsertWPTRunFeatureMetrics( context.Context, int64, map[string]wptconsumertypes.WPTFeatureMetric) error }
WebFeatureWPTScoreStorer describes the interface to store run data and metrics data.
type WebFeaturesDataGetter ¶
type WebFeaturesDataGetter interface { // Get the web features metadata for the particular commit sha. GetWebFeaturesData(context.Context, string) (shared.WebFeaturesData, error) }
WebFeaturesDataGetter describes an interface that will get the web features data.