Documentation ¶
Index ¶
Constants ¶
const ( // EV_TRYJOB_EXP_CHANGED is the event type that is fired when the expectations // for an issue change. It sends an instance of *TryjobExpChange. EV_TRYJOB_EXP_CHANGED = "tryjobstore:change" // EV_TRYJOB_UPDATED is the event that is fired when a tryjob is updated (update or creation). EV_TRYJOB_UPDATED = "tryjobstore:tryjob-updated" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Issue ¶
type Issue struct { ID int64 `json:"id"` Subject string `json:"subject" datastore:",noindex"` Owner string `json:"owner"` Updated time.Time `json:"updated"` URL string `json:"url" datastore:",noindex"` Status string `json:"status"` PatchsetDetails []*PatchsetDetail `json:"patchsets" datastore:",noindex"` Committed bool `json:"committed" datastore:"Commited"` QueryPatchsets []int64 `json:"queryPatchsets" datastore:"-"` CommentAdded bool `json:"-" datastore:",noindex"` // contains filtered or unexported fields }
Issue captures information about a single code review issue.
func (*Issue) FindPatchset ¶
func (is *Issue) FindPatchset(id int64) *PatchsetDetail
FindPatchset returns the with the given id or nil if cannot be found
func (*Issue) HasPatchset ¶
HasPatchset returns true if the issue has the given patchset.
func (*Issue) MarshalJSON ¶
MarshalJSON implements the Marshaller interface in encoding/json.
func (*Issue) UpdatePatchsets ¶
func (is *Issue) UpdatePatchsets(patchsets []*PatchsetDetail)
UpdatePatchset merges the given patchset information into this issue.
type IssueExpChange ¶
type IssueExpChange struct {
IssueID int64 `json:"issueID"`
}
IssueExpChange is used as the event type when tryjob related information changes and an event is sent to notify client.
type NewValueFn ¶
type NewValueFn func(data interface{}) interface{}
NewValueFn is a callback function that allows to update the value of datastore entity within a transation. It receives the current value an entity and returns the updated value or nil, if it does not want to update the current value.
type Parameters ¶
type Parameters = buildbucket.Parameters
Reuse types from the buildbucket package.
type PatchsetDetail ¶
type PatchsetDetail struct { ID int64 `json:"id"` Commit string `json:"commit"` ParentCommit string `json:"parentCommit"` Tryjobs []*Tryjob `json:"tryjobs" datastore:"-"` }
PatchsetDetails accumulates information about one patchset and the connected tryjobs.
type Properties ¶
type Properties = buildbucket.Properties
type TimeJsonMs ¶
func (TimeJsonMs) MarshalJSON ¶
func (j TimeJsonMs) MarshalJSON() ([]byte, error)
type Tryjob ¶
type Tryjob struct { Key *datastore.Key `json:"-" datastore:"__key__"` // Insert the key upon loading BuildBucketID int64 `json:"buildBucketID"` IssueID int64 `json:"issueID"` PatchsetID int64 `json:"patchsetID"` Builder string `json:"builder"` Status TryjobStatus `json:"status"` Updated time.Time `json:"-"` MasterCommit string `json:"masterCommit"` }
Tryjob captures information about a tryjob in BuildBucket.
type TryjobResult ¶
type TryjobResult struct { TestName string `datastore:"TestName,noindex"` Digest string `datastore:"Digest,noindex"` Params paramtools.ParamSet `datastore:"-"` }
TryjobResult stores results. It is stored in the database as a child of a Tryjob entity.
type TryjobStatus ¶
type TryjobStatus int
TryjobStatus is an enum that captures the status of a tryjob.
const ( TRYJOB_SCHEDULED TryjobStatus = iota TRYJOB_RUNNING TRYJOB_COMPLETE TRYJOB_INGESTED TRYJOB_FAILED TRYJOB_UNKNOWN )
States of a tryjob in increasing order.
func (TryjobStatus) MarshalJSON ¶
func (t TryjobStatus) MarshalJSON() ([]byte, error)
Serialize TryjobStatus as string to JSON.
func (TryjobStatus) String ¶
func (t TryjobStatus) String() string
String returns a tryjob status as a string.
func (*TryjobStatus) UnmarshalJSON ¶
func (t *TryjobStatus) UnmarshalJSON(data []byte) error
Deserialize a TryjobStatus from JSON.
type TryjobStore ¶
type TryjobStore interface { // ListIssues lists all current issues in the store. The offset and size are // used for pagination. 'offset' defines the starting index (zero based) of the // page and size defines the size of the page. // The function returns a a list of issues and the total number of issues. ListIssues(offset, size int) ([]*Issue, int, error) // GetIssue retrieves information about the given issue and patchsets. If needded // this will include tryjob information. GetIssue(issueID int64, loadTryjobs bool) (*Issue, error) // UpdateIssue updates the given issue with the provided data. If the issue does not // exist in the database it will be created. If updateFn is nil, issue will be // written to the database unconditionally, updateFn is used as described above. UpdateIssue(details *Issue, updateFn NewValueFn) error // CommitIssueExp commits the expecations of the given issue. The writeFn // is expected to make the changes to the master baseline. An issue is // marked as committed if the writeFn runs without error. CommitIssueExp(issueID int64, writeFn func() error) error // DeleteIssue deletes the given issue and related information. DeleteIssue(issueID int64) error // GetTryjobs returns the Tryjobs for given issues. If filterDup is true it // will also filter duplicate tryjobs for each patchset and only keep the newest. // If loadResults is true it will also load the Tryjob results. The second // return value will contain the results of the Tryjob with same index in the // first return value. GetTryjobs(issueID int64, patchsetIDs []int64, filterDup bool, loadResults bool) ([]*Tryjob, [][]*TryjobResult, error) // RunningTryjobs returns a list of tryjobs that are considered running by // the datastore (their status is less than TRYJOB_COMPLETE) RunningTryjobs() ([]*Tryjob, error) // GetTryjob returns the Tryjob instance defined by issueID and buildBucketID. GetTryjob(issueID, buildBucketID int64) (*Tryjob, error) // GetTryjobResults returns the results for the given Tryjobs. // This is intended to be used when we have a list of Tryjobs already // and we want to avoid another trip to the database to fetch them. The // return slice will match the indices of the input slice. GetTryjobResults(tryjobs []*Tryjob) ([][]*TryjobResult, error) // UpdateTryjob updates the information about a tryjob. If the tryjob does not // exist it will be created. If tryjob is not nil it will be written to the // datastore if it is newer than the current entity. // If tryjob is nil, then the buildBucketID and newValFn are used to load the // current value and update it. If the current entity does not exist an error // is returned. UpdateTryjob(buildBucketID int64, tryjob *Tryjob, newValFn NewValueFn) error // UpdateTryjobResult updates the results for the given tryjob. UpdateTryjobResult(tryjob *Tryjob, results []*TryjobResult) error }
TryjobStore define methods to store tryjob information and code review issues as a key component for for transactional trybot support.
func NewCloudTryjobStore ¶
func NewCloudTryjobStore(client *datastore.Client, expStoreFactory expstorage.IssueExpStoreFactory, eventBus eventbus.EventBus) (TryjobStore, error)
NewCloudTryjobStore creates a new instance of TryjobStore based on cloud datastore.