Documentation ¶
Overview ¶
Package monitor is a helper for keeping a local in memory representation of the key data from some of the robot services. It's purpose is to provice the main data source for packages like the web server and the scheduler. Most of the types are opaque about their contents to allow for lazy aquisition construction or lookup of their members. For instance, id's are normally resolved to objects for you, but that resolve may not happen until the member is asked for.
Index ¶
- func Run(ctx context.Context, managers Managers, owner DataOwner, ...) error
- type Data
- type DataOwner
- type Device
- type Devices
- type Generation
- type Managers
- type Package
- type Packages
- type Replay
- type Replays
- type Report
- type Reports
- type Subject
- type Subjects
- type Trace
- type Traces
- type Track
- type Tracks
- type Worker
- type Workers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(ctx context.Context, managers Managers, owner DataOwner, update func(ctx context.Context, managers *Managers, data *Data) []error) error
Run is used to run a new monitor. It will monitor the data from all the managers that are in the supplied managers, filling in the data structure with all the results it receives. Each time it receives a batch of updates it will invoke the update function passing in the manager set being monitored and the updated set of data.
Types ¶
type Data ¶
type Data struct { Gen *Generation Devices Devices Workers Workers Subjects Subjects Tracks Tracks Packages Packages Traces Traces Reports Reports Replays Replays // contains filtered or unexported fields }
Data is the live store of data from the monitored servers. Entries with no live manager will not be updated.
func (*Data) FindDevice ¶
FindDevice searches the device list for one that matches the supplied id.
type DataOwner ¶
type DataOwner struct {
// contains filtered or unexported fields
}
func NewDataOwner ¶
func NewDataOwner() DataOwner
type Devices ¶
type Devices struct {
// contains filtered or unexported fields
}
Devices is the type that manages a set of Device objects.
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation is a way to handle sequences of 'updates' or 'generations', find out how many have happened, as well as blocking until the next one happens. This does not assume an 'update' to mean anything specific.
func NewGeneration ¶
func NewGeneration() *Generation
NewGeneration returns a new Generation starting with an id of 0.
func (*Generation) After ¶
func (g *Generation) After(id uint64) <-chan struct{}
After returns a channel that will be closed as soon as the generation exceeds ID. This is intended for use in select calls, if you just want to wait, WaitForUpdate is more efficient.
func (*Generation) Get ¶
func (g *Generation) Get() (uint64, chan struct{})
Get returns the generation identifier and blocking channel under the lock
func (*Generation) ID ¶
func (g *Generation) ID() uint64
ID returns the current generation identifier under the lock
func (*Generation) Update ¶
func (g *Generation) Update() uint64
Update increments the generation and notifies all blocked goroutines
func (*Generation) WaitForUpdate ¶
func (g *Generation) WaitForUpdate(previous uint64) uint64
WaitForUpdate blocks until the generation is past previous, and returns the current generation.
type Managers ¶
type Managers struct { Master master.Master Stash *stash.Client Job job.Manager Build build.Store Subject subject.Subjects Trace trace.Manager Report report.Manager Replay replay.Manager }
Managers describes the set of managers to monitor for data changes.
type Package ¶
Package is the in memory representation/wrapper for a build.Package
func (*Package) FindTools ¶
FindTools returns the tool set that matches the supplied device, if the package has one.
func (*Package) FindToolsForAPK ¶
func (p *Package) FindToolsForAPK(ctx context.Context, host *Device, target *Device, apkInfo *apk.Information) *build.AndroidToolSet
FindToolsForAPK returns the best matching tool set for a certain apk on a device, if present in the package.
type Packages ¶
type Packages struct {
// contains filtered or unexported fields
}
Packages is the type that manages a set of Package objects.
type Replays ¶
type Replays struct {
// contains filtered or unexported fields
}
Replays is the type that manages a set of Replay objects.
func (*Replays) Find ¶
Find searches the replays for the one that matches the supplied action. See worker.EquivalentAction for more information about how actions are compared.
func (*Replays) FindOrCreate ¶
FindOrCreate returns the replay that matches the supplied action if it exists, if not it creates a new replay object, and returns it. It does not register the newly created replay object for you, that will happen only if a call is made to trigger the action on the replay service.
type Reports ¶
type Reports struct {
// contains filtered or unexported fields
}
Reports is the type that manages a set of Report objects.
func (*Reports) Find ¶
Find searches the reports for the one that matches the supplied action. See worker.EquivalentAction for more information about how actions are compared.
func (*Reports) FindOrCreate ¶
FindOrCreate returns the report that matches the supplied aciton if it exists, if not it creates a new report object, and returns it. It does not register the newly created report object for you, that will happen only if a call is made to trigger the action on the report service.
type Subjects ¶
type Subjects struct {
// contains filtered or unexported fields
}
Subjects is the type that manages a set of Subject objects.
type Traces ¶
type Traces struct {
// contains filtered or unexported fields
}
Traces is the type that manages a set of Trace objects.
func (*Traces) Find ¶
Find searches the traces for the one that matches the supplied action. See worker.EquivalentAction for more information about how actions are compared.
func (*Traces) FindOrCreate ¶
FindOrCreate returns the trace that matches the supplied aciton if it exists, if not it creates a new trace object, and returns it. It does not register the newly created trace object for you, that will happen only if a call is made to trigger the action on the trace service.
func (*Traces) MatchPackage ¶ added in v0.6.0
MatchPackage returns the set of Trace objects that were traced with a specific package.
type Tracks ¶
type Tracks struct {
// contains filtered or unexported fields
}
Tracks is the type that manages a set of Track objects.