container

package
v0.0.0-...-2f78cd6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRemoteContainerInitResolver

func NewRemoteContainerInitResolver() resolver.Resolver

NewRemoteContainerInitResolver returns a new resolver with determines which container related operation should be run based on local and remote uniter states.

func NewWorkloadHookResolver

func NewWorkloadHookResolver(logger Logger, events WorkloadEvents, eventCompleted func(string)) resolver.Resolver

NewWorkloadHookResolver returns a new resolver with determines which workload related operation should be run based on local and remote uniter states.

Types

type Logger

type Logger interface {
	Tracef(string, ...interface{})
	Debugf(string, ...interface{})
	Errorf(string, ...interface{})
	Warningf(string, ...interface{})
}

Logger defines the logging methods that the package uses.

type WorkloadEvent

type WorkloadEvent struct {
	Type         WorkloadEventType
	WorkloadName string
	NoticeID     string
	NoticeType   string
	NoticeKey    string
	CheckName    string
}

WorkloadEvent contains information about the event type and data associated with the event.

type WorkloadEventCallback

type WorkloadEventCallback func(err error)

WorkloadEventCallback is the type used to callback when an event has been processed.

type WorkloadEventType

type WorkloadEventType int

WorkloadEventType is used to distinguish between each event type triggered by the workload.

const (
	// ReadyEvent is triggered when the container/pebble starts up.
	ReadyEvent WorkloadEventType = iota
	CustomNoticeEvent
	CheckFailedEvent
	CheckRecoveredEvent
)

type WorkloadEvents

type WorkloadEvents interface {
	// AddWorkloadEvent adds the given command arguments and response function
	// and returns a unique identifier.
	AddWorkloadEvent(evt WorkloadEvent, cb WorkloadEventCallback) string

	// GetWorkloadEvent returns the command arguments and response function
	// with the specified ID, as registered in AddWorkloadEvent.
	GetWorkloadEvent(id string) (WorkloadEvent, WorkloadEventCallback, error)

	// RemoveWorkloadEvent removes the command arguments and response function
	// associated with the specified ID.
	RemoveWorkloadEvent(id string)

	// Events returns all the currently queued events pending processing.
	// Useful for debugging/testing.
	Events() []WorkloadEvent

	// EventIDs returns all the ids for the events currently queued.
	EventIDs() []string
}

WorkloadEvents is an interface providing a means of storing and retrieving arguments for running workload hooks.

func NewWorkloadEvents

func NewWorkloadEvents() WorkloadEvents

NewWorkloadEvents returns a new workload event queue.

Jump to

Keyboard shortcuts

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