eventwatcher

package
v0.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Utility for watching events.

Index

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

func (*EventWatcher) Run

func (srv *EventWatcher) Run(ctx context.Context) error

Run starts the service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL