events

package
v0.0.0-...-a87cf6f Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Container - event is related to containers
	Container Type = "container"
	// Image - event is related to images
	Image Type = "image"
	// Pod - event is related to pods
	Pod Type = "pod"
	// Volume - event is related to volumes
	Volume Type = "volume"

	// Attach ...
	Attach Status = "attach"
	// Checkpoint ...
	Checkpoint Status = "checkpoint"
	// Cleanup ...
	Cleanup Status = "cleanup"
	// Commit ...
	Commit Status = "commit"
	// Create ...
	Create Status = "create"
	// Exec ...
	Exec Status = "exec"
	// Exited indicates that a container's process died
	Exited Status = "died"
	// Export ...
	Export Status = "export"
	// History ...
	History Status = "history"
	// Import ...
	Import Status = "import"
	// Init ...
	Init Status = "init"
	// Kill ...
	Kill Status = "kill"
	// LoadFromArchive ...
	LoadFromArchive Status = "status"
	// Mount ...
	Mount Status = "mount"
	// Pause ...
	Pause Status = "pause"
	// Prune ...
	Prune Status = "prune"
	// Pull ...
	Pull Status = "pull"
	// Push ...
	Push Status = "push"
	// Remove ...
	Remove Status = "remove"
	// Restore ...
	Restore Status = "restore"
	// Save ...
	Save Status = "save"
	// Start ...
	Start Status = "start"
	// Stop ...
	Stop Status = "stop"
	// Sync ...
	Sync Status = "sync"
	// Tag ...
	Tag Status = "tag"
	// Unmount ...
	Unmount Status = "unmount"
	// Unpause ...
	Unpause Status = "unpause"
	// Untag ...
	Untag Status = "untag"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// ContainerExitCode is for storing the exit code of a container which can
	// be used for "internal" event notification
	ContainerExitCode int
	// ID can be for the container, image, volume, etc
	ID string
	// Image used where applicable
	Image string
	// Name where applicable
	Name string
	// Status describes the event that occurred
	Status Status
	// Time the event occurred
	Time time.Time
	// Type of event that occurred
	Type Type
}

Event describes the attributes of a libpod event

func NewEvent

func NewEvent(status Status) Event

NewEvent creates a event struct and populates with the given status and time.

func NewEventFromString

func NewEventFromString(event string) (*Event, error)

NewEventFromString takes stringified json and converts it to an event

func (*Event) Recycle

func (e *Event) Recycle(path string, remove bool) error

Recycle checks if the event log has reach a limit and if so renames the current log and starts a new one. The remove bool indicates the old log file should be deleted.

func (*Event) ToHumanReadable

func (e *Event) ToHumanReadable() string

ToHumanReadable returns human readable event as a formatted string

func (*Event) ToJSONString

func (e *Event) ToJSONString() (string, error)

ToJSONString returns the event as a json'ified string

func (*Event) Write

func (e *Event) Write(path string) error

Write will record the event to the given path

type EventFilter

type EventFilter func(*Event) bool

EventFilter for filtering events

type Status

type Status string

Status describes the actual event action (stop, start, create, kill)

func StringToStatus

func StringToStatus(name string) (Status, error)

StringToStatus converts a string to an Event Status TODO if we add more events, we might consider a go-generator to create the switch statement

func (Status) String

func (s Status) String() string

ToString converts a status to a string

type Type

type Type string

Type of event that occurred (container, volume, image, pod, etc)

func StringToType

func StringToType(name string) (Type, error)

StringToType converts string to an EventType

func (Type) String

func (t Type) String() string

ToString converts a Type to a string

Jump to

Keyboard shortcuts

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