luci: go.chromium.org/luci/milo/buildsource/buildbot/buildstore Index | Files

package buildstore

import "go.chromium.org/luci/milo/buildsource/buildbot/buildstore"

Package buildstore implements storage of //milo/api/buildbot/* types.

Index

Package Files

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

Constants

const MasterExpiry = 4 * time.Hour

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

Variables

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 BucketOf Uses

func BucketOf(c context.Context, master string) (string, error)

BucketOf returns LUCI bucket that the given buildbot master is migrating to. Returns "" if it is unknown.

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 EmulationEnabled Uses

func EmulationEnabled(c context.Context) bool

EmulationEnabled returns true if emulation is enabled in c.

func EmulationOf Uses

func EmulationOf(c context.Context, id buildbot.BuildID) (*buildbucket.Build, error)

EmulationOf returns the Buildbucket build that the given Buildbot build is emulating. Returns (nil, nil) if build is not found.

func GetBuild Uses

func GetBuild(c context.Context, id buildbot.BuildID) (*buildbot.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 *buildbot.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 *buildbot.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.

func WithEmulation Uses

func WithEmulation(c context.Context, enabled bool) context.Context

WithEmulation enables or disables emulation.

type ExpireCallback Uses

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

ExpireCallback is called when a build is marked as expired.

type Master Uses

type Master struct {
    buildbot.Master
    Internal bool
    Modified time.Time
}

Master is buildbot.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, refreshState bool) (*Master, error)

GetMaster fetches a master.

If refreshState is true, refreshes individual builds from the datastore and the list of Cached builds.

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     []*buildbot.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
    Yes
    No
)

Package buildstore imports 48 packages (graph) and is imported by 4 packages. Updated 2018-10-23. Refresh now. Tools for package owners.