state

package
v1.3.15 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MPL-2.0 Imports: 2 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookState

type HookState struct {
	// Prestart is true if the hook has run Prestart successfully and does
	// not need to run again
	PrestartDone bool

	// Data allows hooks to persist arbitrary state.
	Data map[string]string

	// Environment variables set by the hook that will continue to be set
	// even if PrestartDone=true.
	Env map[string]string
}

func (*HookState) Copy

func (h *HookState) Copy() *HookState

Copy HookState. Returns nil if its nil.

func (*HookState) Equal

func (h *HookState) Equal(o *HookState) bool

type LocalState

type LocalState struct {
	Hooks map[string]*HookState

	// DriverNetwork is the network information returned by the task
	// driver's Start method
	DriverNetwork *drivers.DriverNetwork

	// TaskHandle is the handle used to reattach to the task during recovery
	TaskHandle *drivers.TaskHandle

	// RunComplete is set to true when the TaskRunner.Run() method finishes.
	// It is used to distinguish between a dead task that could be restarted
	// and one that will never run again.
	RunComplete bool
}

LocalState is Task state which is persisted for use when restarting Nomad agents.

func NewLocalState

func NewLocalState() *LocalState

func (*LocalState) Canonicalize

func (s *LocalState) Canonicalize()

Canonicalize ensures LocalState is in a consistent state by initializing Hooks and ensuring no HookState's are nil. Useful for cleaning unmarshalled state which may be in an unknown state.

func (*LocalState) Copy

func (s *LocalState) Copy() *LocalState

Copy LocalState. Returns nil if nil.

Jump to

Keyboard shortcuts

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