events

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxEventsToKeep = 64

MaxEventsToKeep is maximum number of events to keep per service before dropping old entries.

Variables

This section is empty.

Functions

func NullRecorder

func NullRecorder(newstate ServiceState, message string, args ...any)

NullRecorder discards events.

Types

type Recorder

type Recorder func(newstate ServiceState, message string, args ...any)

Recorder adds new event to the history of events, formatting message with args using Sprintf.

type ServiceEvent

type ServiceEvent struct {
	Message   string
	State     ServiceState
	Health    health.Status
	Timestamp time.Time
}

ServiceEvent describes state change of the running service.

func (*ServiceEvent) AsProto

func (event *ServiceEvent) AsProto(service string) *machineapi.ServiceStateEvent

AsProto returns protobuf representation of respective machined event.

type ServiceEvents

type ServiceEvents struct {
	// contains filtered or unexported fields
}

ServiceEvents is a fixed length history of events.

func (*ServiceEvents) AsProto

func (events *ServiceEvents) AsProto(count int) *machineapi.ServiceEvents

AsProto returns protobuf-ready serialized snapshot.

func (*ServiceEvents) Get

func (events *ServiceEvents) Get(count int) (result []ServiceEvent)

Get return a copy of event history, with most recent event being the last one.

func (*ServiceEvents) Push

func (events *ServiceEvents) Push(event ServiceEvent)

Push appends new event to the history popping out oldest event on overflow.

type ServiceState

type ServiceState int

ServiceState is enum of service run states.

const (
	StateInitialized ServiceState = iota
	StatePreparing
	StateWaiting
	StateRunning
	StateStopping
	StateFinished
	StateFailed
	StateSkipped
	StateStarting
)

ServiceState constants.

func (ServiceState) String

func (state ServiceState) String() string

Jump to

Keyboard shortcuts

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