Documentation ¶
Overview ¶
Package ops provides code that observes the tracker state, and takes appropriate actions. It basically implements a simple state machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
An Action describes an operation to be applied to jobs that meet the required condition. Monitor handles the selection of Action, and the transition to the next State on success.
type ActionFunc ¶
An ActionFunc performs an operation on a job, and updates its state. These functions may take a long time to complete, and may be resource intensive. Time parameter is the last state transition time.
type ConditionFunc ¶
A ConditionFunc checks whether a Job meets some condition. These functions may take a long time to complete, but should NOT use a lot of resources.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor "owns" all jobs in the states that have actions.
func NewMonitor ¶
func NewMonitor(clientCtx context.Context, config cloud.BQConfig, tk *tracker.Tracker) (*Monitor, error)
NewMonitor creates a Monitor with no Actions
func NewStandardMonitor ¶
func NewStandardMonitor(ctx context.Context, project, inputBucket string, config cloud.BQConfig, tk *tracker.Tracker) (*Monitor, error)
NewStandardMonitor creates the standard monitor that handles several state transitions.
func (*Monitor) AddAction ¶
func (m *Monitor) AddAction(state tracker.State, cond ConditionFunc, op ActionFunc, successState tracker.State)
AddAction adds a specific action to the Monitor.
type Outcome ¶
type Outcome struct {
// contains filtered or unexported fields
}
Outcome is a custom error for use in this package. It is a little unusual in that it can encode a successful outcome, in which case Unwrap will return nil.
func (Outcome) ShouldRetry ¶
ShouldRetry indicates of the operation should be retried later.