luci: Index | Files

package buildstore

import ""

Package buildstore implements storage of //milo/buildsource/buildbot/buildbotapi/* types.


Package Files

annotations.go blame.go build.go buildbucket.go doc.go encoding.go master.go query.go


const MasterExpiry = 4 * time.Hour

MasterExpiry is how long a master entity can be stale before we consider it to be expired.


var ErrNoBuildNumber = errors.BoolTag{Key: errors.NewTagKey("no buildnumber")}

ErrNoBuildNumber is an error tag indicating that a build does not have a build number.

var ImportRejectedTag = errors.BoolTag{
    Key: errors.NewTagKey("import rejected"),

ImportRejectedTag is tagged to an error when an entity cannot be mutated anymore.

var TooBigTag = errors.BoolTag{
    Key: errors.NewTagKey("entity was not saved because it was too large to store"),

TooBigTag indicates that entity was not saved because it was too large to store.

func CanAccessMaster Uses

func CanAccessMaster(c context.Context, name string) error

CanAccessMaster returns nil if the currently logged in user can see the masters, or if the given master is a known public master, otherwise an error.

func GetBuild Uses

func GetBuild(c context.Context, id buildbotapi.BuildID) (*buildbotapi.Build, error)

GetBuild fetches a buildbot build from the storage. Returns (nil, nil) if build is not found. Does not check access.

func GetPendingCounts Uses

func GetPendingCounts(c context.Context, builders []string) ([]int, error)

GetPendingCounts returns numbers of pending builds in builders. builders must be a list of slash-separated master, builder names.

func PutPendingCount Uses

func PutPendingCount(c context.Context, master, builder string, count int) error

PutPendingCount persists number of pending builds to a builder. Useful for testing.

func SaveBuild Uses

func SaveBuild(c context.Context, b *buildbotapi.Build) (replaced bool, err error)

SaveBuild persists the build in the storage.

This will also update the model.BuildSummary and model.BuilderSummary.

func SaveMaster Uses

func SaveMaster(c context.Context, master *buildbotapi.Master,
    internal bool, expireCallback ExpireCallback) error

SaveMaster persists the master in the storage.

Expires all incomplete builds in the datastore associated with this master and

- associated with builders not declared in master.Builders
- OR or not "current" from this master's perspective and >=20min stale.

type ExpireCallback Uses

type ExpireCallback func(b *buildbotapi.Build, reason string)

ExpireCallback is called when a build is marked as expired.

type Master Uses

type Master struct {
    Internal bool
    Modified time.Time

Master is buildbotapi.Master plus extra storage-level information.

func AllMasters Uses

func AllMasters(c context.Context, checkAccess bool) ([]*Master, error)

AllMasters returns all buildbot masters.

func GetMaster Uses

func GetMaster(c context.Context, name string) (*Master, error)

GetMaster fetches a master.

If any of the master's builders is emulated, the returned Master does not have any slave information or pending build states.

Does not check access.

type Query Uses

type Query struct {
    Master   string
    Builder  string
    Limit    int
    Finished Ternary
    Cursor   string

    // KeyOnly, if true, makes the datastore query keys-only.
    // Loaded Buildbot builds will have only master, builder and number.
    KeyOnly bool // make the data

    // NoAnnotationFetch, if true, will not fetch annotation proto from LogDog.
    // Loaded LUCI builds will not have properties, steps, logs or text.
    NoAnnotationFetch bool

    // NoChangeFetch, if true, will not load change history from Gitiles.
    // Loaded LUCI builds will not have Blame or SourceStamp.Changes.
    NoChangeFetch bool

Query is a build query.

type QueryResult Uses

type QueryResult struct {
    Builds     []*buildbotapi.Build // ordered from greater-number to lower-number
    NextCursor string
    PrevCursor string

QueryResult is a result of running a Query.

func GetBuilds Uses

func GetBuilds(c context.Context, q Query) (*QueryResult, error)

GetBuilds executes a build query and returns results. Does not check access.

type Ternary Uses

type Ternary int

Ternary has 3 defined values: either (zero), yes and no.

const (
    Either Ternary = iota

Package buildstore imports 45 packages (graph) and is imported by 4 packages. Updated 2020-02-27. Refresh now. Tools for package owners.