events

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedQueue = errors.New("queue is closed")

Functions

This section is empty.

Types

type EventHandler

type EventHandler struct {
	Opts  Options
	Queue chan fsnotify.Event

	Finished bool
	// contains filtered or unexported fields
}

EventHandler represents the datastructure for an EventHandler instance. This struct satisfies the EventHandler interface.

func NewEventHandler

func NewEventHandler(opts Options) *EventHandler

func (*EventHandler) Listen

func (h *EventHandler) Listen(ctx context.Context, control PodControl)

Listen spawns workers and listens to the queue It's a blocking function and waits for a cancellation invocation from the Client.

func (*EventHandler) Push

func (h *EventHandler) Push(event fsnotify.Event)

Push adds a new event payload to the queue.

type Options

type Options struct {
	MaxWorkers   int // Number of workers to spawn.
	MaxQueueSize int // Maximum length for the queue to hold events.
}

Options represent options for SlurmEventHandler.

type PodControl

type PodControl struct {
	UpdateStatus         func(pod *corev1.Pod)
	LoadFromDisk         func(podRef client.ObjectKey) (*corev1.Pod, error)
	NotifyVirtualKubelet func(pod *corev1.Pod)
}

Jump to

Keyboard shortcuts

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