Documentation ¶
Overview ¶
Package buildstore implements storage of //milo/buildsource/buildbot/buildbotapi/* types.
Index ¶
- Constants
- Variables
- func BucketOf(c context.Context, master string) (string, error)
- func CanAccessMaster(c context.Context, name string) error
- func EmulationEnabled(c context.Context) bool
- func EmulationOf(c context.Context, id buildbotapi.BuildID) (*deprecated.Build, error)
- func GetBuild(c context.Context, id buildbotapi.BuildID) (*buildbotapi.Build, error)
- func GetPendingCounts(c context.Context, builders []string) ([]int, error)
- func PutPendingCount(c context.Context, master, builder string, count int) error
- func SaveBuild(c context.Context, b *buildbotapi.Build) (replaced bool, err error)
- func SaveMaster(c context.Context, master *buildbotapi.Master, internal bool, ...) error
- func WithEmulation(c context.Context, enabled bool) context.Context
- type ExpireCallback
- type Master
- type Query
- type QueryResult
- type Ternary
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.
Functions ¶
func BucketOf ¶
BucketOf returns LUCI bucket that the given buildbot master is migrating to. Returns "" if it is unknown.
func CanAccessMaster ¶
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 ¶
EmulationEnabled returns true if emulation is enabled in c.
func EmulationOf ¶
func EmulationOf(c context.Context, id buildbotapi.BuildID) (*deprecated.Build, error)
EmulationOf returns the Buildbucket build that the given Buildbot build is emulating. Returns (nil, nil) if build is not found.
func GetBuild ¶
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 ¶
GetPendingCounts returns numbers of pending builds in builders. builders must be a list of slash-separated master, builder names.
func PutPendingCount ¶
PutPendingCount persists number of pending builds to a builder. Useful for testing.
func SaveBuild ¶
SaveBuild persists the build in the storage.
This will also update the model.BuildSummary and model.BuilderSummary.
func SaveMaster ¶
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.
Types ¶
type ExpireCallback ¶
type ExpireCallback func(b *buildbotapi.Build, reason string)
ExpireCallback is called when a build is marked as expired.
type Master ¶
type Master struct { buildbotapi.Master Internal bool Modified time.Time }
Master is buildbotapi.Master plus extra storage-level information.
func AllMasters ¶
AllMasters returns all buildbot masters.
type Query ¶
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 ¶
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.