events

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package events defines an interface for receiving interruption events, along with cloud-provider specific implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterruptionEvent

type InterruptionEvent struct {
	MessageID  string
	ResourceID string
}

InterruptionEvent represents a generic event when an instance is interrupted, regardless of cloud provider

type NewPubSubNotifierInput

type NewPubSubNotifierInput struct {
	Logger           *zap.SugaredLogger
	ProjectID        string
	SubscriptionName string
}

NewPubSubNotifierInput defines all required fields to create a PubSubNotifier

type Notifier

type Notifier interface {
	Receive(ctx context.Context, event chan<- InterruptionEvent)
}

Notifier is responsible for sending InterruptionEvents to event channel whenever an instance is interrupted. There should generally be one Notifier implementation per cloud provider

func NewPubSubNotifier

func NewPubSubNotifier(ctx context.Context, input *NewPubSubNotifierInput) (Notifier, error)

NewPubSubNotifier receives messages from the spot-instances-preemption-events subscription

type Subscription

type Subscription interface {
	Receive(ctx context.Context, f func(context.Context, *gcppubsub.Message)) error
}

Jump to

Keyboard shortcuts

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