web

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DEFAULT_PAGE_SIZE is the default page size used for pagination.
	DEFAULT_PAGE_SIZE = 20

	// MAX_PAGE_SIZE is the maximum page size used for pagination.
	MAX_PAGE_SIZE = 100
)

Variables

This section is empty.

Functions

func MakeResourceHandler

func MakeResourceHandler(resourceDir string) func(http.ResponseWriter, *http.Request)

MakeResourceHandler creates a static file handler that sets a caching policy.

Types

type ByBlame

type ByBlame struct {
	Test          string                   `json:"test"`
	Digest        string                   `json:"digest"`
	Blame         *blame.BlameDistribution `json:"blame"`
	CommitIndices []int                    `json:"commit_indices"`
	Key           string
}

ByBlame describes a single digest and it's blames.

type ByBlameEntry

type ByBlameEntry struct {
	GroupID       string           `json:"groupID"`
	NDigests      int              `json:"nDigests"`
	NTests        int              `json:"nTests"`
	AffectedTests []*TestRollup    `json:"affectedTests"`
	Commits       []*tiling.Commit `json:"commits"`
}

ByBlameEntry is a helper structure that is serialized to JSON and sent to the front-end.

type ByBlameEntrySlice

type ByBlameEntrySlice []*ByBlameEntry

func (ByBlameEntrySlice) Len

func (b ByBlameEntrySlice) Len() int

func (ByBlameEntrySlice) Less

func (b ByBlameEntrySlice) Less(i, j int) bool

func (ByBlameEntrySlice) Swap

func (b ByBlameEntrySlice) Swap(i, j int)

type ClusterDiffResult

type ClusterDiffResult struct {
	Nodes []Node `json:"nodes"`
	Links []Link `json:"links"`

	Test             string                         `json:"test"`
	ParamsetByDigest map[string]map[string][]string `json:"paramsetByDigest"`
	ParamsetsUnion   map[string][]string            `json:"paramsetsUnion"`
}

ClusterDiffResult contains the result of comparing all digests within a test. It is structured to be easy to render by the D3.js.

type CommitSlice

type CommitSlice []*tiling.Commit

CommitSlice is a utility type simple for sorting Commit slices so earliest commits come first.

func (CommitSlice) Len

func (p CommitSlice) Len() int

func (CommitSlice) Less

func (p CommitSlice) Less(i, j int) bool

func (CommitSlice) Swap

func (p CommitSlice) Swap(i, j int)

type FailureList

type FailureList struct {
	Count          int                   `json:"count"`
	DigestFailures []*diff.DigestFailure `json:"failures"`
}

FailureList contains the list of the digests that could not be processed the count value is for convenience to make it easier to inspect the JSON output and might be removed in the future.

type IgnoresRequest

type IgnoresRequest struct {
	Duration string `json:"duration"`
	Filter   string `json:"filter"`
	Note     string `json:"note"`
}

IgnoresRequest encapsulates a single ignore rule that is submitted for addition or update.

type Link struct {
	Source int     `json:"source"`
	Target int     `json:"target"`
	Value  float32 `json:"value"`
}

Link represents a link between d3 nodes, used in ClusterDiffResult.

type Node

type Node struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

Node represents a single node in a d3 diagram. Used in ClusterDiffResult.

type ResponseEnvelope

type ResponseEnvelope struct {
	Data       *interface{}                  `json:"data"`
	Err        *string                       `json:"err"`
	Status     int                           `json:"status"`
	Pagination *httputils.ResponsePagination `json:"pagination"`
}

ResponseEnvelope wraps all responses. Some fields might be empty depending on context or whether there was an error or not.

type SearchDigestSlice

type SearchDigestSlice []*search.Digest

SearchDigestSlice is for sorting search.Digest's in the order of digest status.

func (SearchDigestSlice) Len

func (p SearchDigestSlice) Len() int

func (SearchDigestSlice) Less

func (p SearchDigestSlice) Less(i, j int) bool

func (SearchDigestSlice) Swap

func (p SearchDigestSlice) Swap(i, j int)

type SummarySlice

type SummarySlice []*summary.Summary

func (SummarySlice) Len

func (p SummarySlice) Len() int

func (SummarySlice) Less

func (p SummarySlice) Less(i, j int) bool

func (SummarySlice) Swap

func (p SummarySlice) Swap(i, j int)

type TestRollup

type TestRollup struct {
	Test         string `json:"test"`
	Num          int    `json:"num"`
	SampleDigest string `json:"sample_digest"`
}

type TriageRequest

type TriageRequest struct {
	// TestDigestStatus maps status to test name and digests as: map[testName][digest]status
	TestDigestStatus map[string]map[string]string `json:"testDigestStatus"`

	// Issue is the id of the code review issue for which we want to change the expectations.
	Issue int64 `json:"issue"`
}

TriageRequest is the form of the JSON posted to jsonTriageHandler.

type WebHandlers

type WebHandlers struct {
	Storages      *storage.Storage
	StatusWatcher *status.StatusWatcher
	Indexer       *indexer.Indexer
	IssueTracker  issues.IssueTracker
	SearchAPI     *search.SearchAPI
}

WebHandlers holds the environment needed by the various http hander functions that have WebHandlers as its receiver.

func (*WebHandlers) JsonBaselineHandler

func (wh *WebHandlers) JsonBaselineHandler(w http.ResponseWriter, r *http.Request)

JsonBaselineHandler returns a JSON representation of that baseline including baselines for a options issue. It can respond to requests like these:

/json/baseline
/json/baseline/64789

where the latter contains the issue id for which we would like to retrieve the baseline. In that case the returned options will be blend of the master baseline and the baseline defined for the issue (usually based on tryjob results).

func (*WebHandlers) JsonByBlameHandler

func (wh *WebHandlers) JsonByBlameHandler(w http.ResponseWriter, r *http.Request)

JsonByBlameHandler returns a json object with the digests to be triaged grouped by blamelist.

func (*WebHandlers) JsonClearDigests

func (wh *WebHandlers) JsonClearDigests(w http.ResponseWriter, r *http.Request)

JsonClearDigests clears digests from the local cache and GS.

func (*WebHandlers) JsonClearFailureHandler

func (wh *WebHandlers) JsonClearFailureHandler(w http.ResponseWriter, r *http.Request)

JsonClearFailureHandler removes failing digests from the local cache and returns the current failures.

func (*WebHandlers) JsonClusterDiffHandler

func (wh *WebHandlers) JsonClusterDiffHandler(w http.ResponseWriter, r *http.Request)

JsonClusterDiffHandler calculates the NxN diffs of all the digests that match the incoming query and returns the data in a format appropriate for handling in d3.

func (*WebHandlers) JsonCommitsHandler

func (wh *WebHandlers) JsonCommitsHandler(w http.ResponseWriter, r *http.Request)

JsonParamsHandler returns the most current commits.

func (*WebHandlers) JsonCompareTestHandler

func (wh *WebHandlers) JsonCompareTestHandler(w http.ResponseWriter, r *http.Request)

JsonCompareTestHandler returns a JSON description for the given test. The result is intended to be displayed in a grid-like fashion.

Input format of a POST request:

Output format in JSON:

func (*WebHandlers) JsonDetailsHandler

func (wh *WebHandlers) JsonDetailsHandler(w http.ResponseWriter, r *http.Request)

JsonDetailsHandler returns the details about a single digest.

func (*WebHandlers) JsonDiffHandler

func (wh *WebHandlers) JsonDiffHandler(w http.ResponseWriter, r *http.Request)

JsonDiffHandler returns difference between two digests.

func (*WebHandlers) JsonExportHandler

func (wh *WebHandlers) JsonExportHandler(w http.ResponseWriter, r *http.Request)

JsonExportHandler is the endpoint to export the Gold knowledge base. It has the same interface as the search endpoint.

func (*WebHandlers) JsonIgnoresAddHandler

func (wh *WebHandlers) JsonIgnoresAddHandler(w http.ResponseWriter, r *http.Request)

JsonIgnoresAddHandler is for adding a new ignore rule.

func (*WebHandlers) JsonIgnoresDeleteHandler

func (wh *WebHandlers) JsonIgnoresDeleteHandler(w http.ResponseWriter, r *http.Request)

JsonIgnoresDeleteHandler deletes an existing ignores rule.

func (*WebHandlers) JsonIgnoresHandler

func (wh *WebHandlers) JsonIgnoresHandler(w http.ResponseWriter, r *http.Request)

JsonIgnoresHandler returns the current ignore rules in JSON format.

func (*WebHandlers) JsonIgnoresUpdateHandler

func (wh *WebHandlers) JsonIgnoresUpdateHandler(w http.ResponseWriter, r *http.Request)

JsonIgnoresUpdateHandler updates an existing ignores rule.

func (*WebHandlers) JsonListFailureHandler

func (wh *WebHandlers) JsonListFailureHandler(w http.ResponseWriter, r *http.Request)

JsonListFailureHandler returns the digests that have failed to load.

func (*WebHandlers) JsonListTestsHandler

func (wh *WebHandlers) JsonListTestsHandler(w http.ResponseWriter, r *http.Request)

JsonListTestsHandler returns a JSON list with high level information about each test.

It takes these parameters:

include - If true ignored digests should be included. (true, false)
query   - A query to restrict the responses to, encoded as a URL encoded paramset.
head    - if only digest that appear at head should be included.
unt     - If true include tests that have untriaged digests. (true, false)
pos     - If true include tests that have positive digests. (true, false)
neg     - If true include tests that have negative digests. (true, false)

The return format looks like:

[
  {
    "name": "01-original",
    "diameter": 123242,
    "untriaged": 2,
    "num": 2
  },
  ...
]

func (*WebHandlers) JsonParamsHandler

func (wh *WebHandlers) JsonParamsHandler(w http.ResponseWriter, r *http.Request)

JsonParamsHandler returns the union of all parameters.

func (*WebHandlers) JsonRefreshIssue

func (wh *WebHandlers) JsonRefreshIssue(w http.ResponseWriter, r *http.Request)

JsonRefreshIssue forces a refresh of a Gerrit issue, i.e. reload data that might not have been polled yet etc.

func (*WebHandlers) JsonSearchHandler

func (wh *WebHandlers) JsonSearchHandler(w http.ResponseWriter, r *http.Request)

JsonSearchHandler is the endpoint for all searches.

func (*WebHandlers) JsonStatusHandler

func (wh *WebHandlers) JsonStatusHandler(w http.ResponseWriter, r *http.Request)

JsonStatusHandler returns the current status of with respect to HEAD.

func (*WebHandlers) JsonTriageHandler

func (wh *WebHandlers) JsonTriageHandler(w http.ResponseWriter, r *http.Request)

JsonTriageHandler handles a request to change the triage status of one or more digests of one test.

It accepts a POST'd JSON serialization of TriageRequest and updates the expectations.

func (*WebHandlers) JsonTriageLogHandler

func (wh *WebHandlers) JsonTriageLogHandler(w http.ResponseWriter, r *http.Request)

JsonTriageLogHandler returns the entries in the triagelog paginated in reverse chronological order.

func (*WebHandlers) JsonTriageUndoHandler

func (wh *WebHandlers) JsonTriageUndoHandler(w http.ResponseWriter, r *http.Request)

JsonTriageUndoHandler performs an "undo" for a given change id. The change id's are returned in the result of jsonTriageLogHandler. It accepts one query parameter 'id' which is the id if the change that should be reversed. If successful it returns the same result as a call to jsonTriageLogHandler to reflect the changed triagelog.

func (*WebHandlers) JsonTryjobListHandler

func (wh *WebHandlers) JsonTryjobListHandler(w http.ResponseWriter, r *http.Request)

JsonTryjobListHandler returns the list of Gerrit issues that have triggered or produced tryjob results recently.

func (*WebHandlers) JsonTryjobSummaryHandler

func (wh *WebHandlers) JsonTryjobSummaryHandler(w http.ResponseWriter, r *http.Request)

JsonTryjobsSummaryHandler is the endpoint to get a summary of the tryjob results for a Gerrit issue.

func (*WebHandlers) TextAllHashesHandler

func (wh *WebHandlers) TextAllHashesHandler(w http.ResponseWriter, r *http.Request)

textAllHashesHandler returns the list of all hashes we currently know about regardless of triage status. Endpoint used by the buildbots to avoid transferring already known images.

Jump to

Keyboard shortcuts

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