Documentation ¶
Overview ¶
Utility for watching events.
Index ¶
- func AssertEvents(ctx context.Context, c chan *api.EventMessage, jobIds map[string]bool, ...) error
- func ErrorOnFailed(parent context.Context, C chan *api.EventMessage) error
- func ErrorOnNoActiveJobs(parent context.Context, C chan *api.EventMessage, jobIds map[string]bool) error
- func GetFromIngresses(parent context.Context, C chan *api.EventMessage) error
- type ErrUnexpectedEvent
- type EventWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEvents ¶
func AssertEvents(ctx context.Context, c chan *api.EventMessage, jobIds map[string]bool, expected []*api.EventMessage) error
AssertEvents compares the events received for each job with the expected events.
func ErrorOnFailed ¶
func ErrorOnFailed(parent context.Context, C chan *api.EventMessage) error
ErrorOnFailed returns an error on job failure.
func ErrorOnNoActiveJobs ¶
func ErrorOnNoActiveJobs(parent context.Context, C chan *api.EventMessage, jobIds map[string]bool) error
ErrorOnNoActiveJobs returns an error if there are no active jobs.
func GetFromIngresses ¶
func GetFromIngresses(parent context.Context, C chan *api.EventMessage) error
GetFromIngresses listens for ingressInfo messages and tries to download from each ingress. Returns false if any download fails.
Types ¶
type ErrUnexpectedEvent ¶
type ErrUnexpectedEvent struct {
// contains filtered or unexported fields
}
ErrUnexpectedEvent indicates the wrong event type was received.
func (*ErrUnexpectedEvent) Error ¶
func (err *ErrUnexpectedEvent) Error() string
type EventWatcher ¶
type EventWatcher struct { Out io.Writer Queue string JobSetName string ApiConnectionDetails *client.ApiConnectionDetails C chan *api.EventMessage // BackoffExponential produces increasing intervals for each retry attempt. // // The scalar is multiplied times 2 raised to the current attempt. So the first // retry with a scalar of 100ms is 100ms, while the 5th attempt would be 1.6s. BackoffExponential time.Duration // MaxRetries is the number of consecutive retries until the watcher gives up. MaxRetries uint }
EventWatcher is a service for watching for events and forwarding those on C. It connects to a server using ApiConnectionDetails and subscribes to events (queue, jobSetName).
func New ¶
func New(queue string, jobSetName string, apiConnectionDetails *client.ApiConnectionDetails) *EventWatcher
Click to show internal directories.
Click to hide internal directories.