Documentation ¶
Overview ¶
Package runtime defines interfaces for accessing runtime specific settings, and state.
Index ¶
- Variables
- type ClusterState
- type Controller
- type ControllerOption
- type ControllerOptions
- type Event
- type EventFatalSequencerError
- type EventSequenceStart
- type EventStream
- type LogHandler
- type LogOption
- type LogOptions
- type LoggingManager
- type Machine
- type MachineState
- type Mode
- type Phase
- type Platform
- type Publisher
- type Runtime
- type Sequence
- type Sequencer
- type State
- type TaskExecutionFunc
- type TaskSetupFunc
- type WatchFunc
- type WatchOptionFunc
- type WatchOptions
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLocked indicates that the sequencer is currently locked, and processing // another sequence. ErrLocked = errors.New("locked") // ErrReboot indicates that a task is requesting a reboot. ErrReboot = errors.New("reboot") // ErrInvalidSequenceData indicates that the sequencer got data the wrong // data type for a sequence. ErrInvalidSequenceData = errors.New("invalid sequence data") // ErrUndefinedRuntime indicates that the sequencer's runtime is not defined. ErrUndefinedRuntime = errors.New("undefined runtime") )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { Runtime() Runtime Sequencer() Sequencer Run(Sequence, interface{}, ...ControllerOption) error }
Controller represents the controller responsible for managing the execution of sequences.
type ControllerOption ¶ added in v0.6.0
type ControllerOption func(o *ControllerOptions) error
ControllerOption represents an option setter.
func WithForce ¶ added in v0.6.0
func WithForce() ControllerOption
WithForce sets the force option to true.
type ControllerOptions ¶ added in v0.6.0
type ControllerOptions struct {
Force bool
}
ControllerOptions represents the options for a controller.
func DefaultControllerOptions ¶ added in v0.6.0
func DefaultControllerOptions() ControllerOptions
DefaultControllerOptions returns the default controller options.
type EventFatalSequencerError ¶
EventFatalSequencerError represents a fatal sequencer error.
type EventSequenceStart ¶
type EventSequenceStart struct {
Sequence Sequence
}
EventSequenceStart represents the sequence start event.
type EventStream ¶
EventStream defines the runtime event stream.
type LogHandler ¶ added in v0.6.0
type LogHandler interface { Writer() (io.WriteCloser, error) Reader(opt ...LogOption) (io.ReadCloser, error) }
LogHandler provides interface to access particular log file.
type LogOption ¶ added in v0.6.0
type LogOption func(*LogOptions) error
LogOption provides functional options for LogHandler.Reader.
func WithFollow ¶ added in v0.6.0
func WithFollow() LogOption
WithFollow enables follow mode for the logs.
func WithTailLines ¶ added in v0.6.0
WithTailLines starts log reading from lines from the tail of the log.
type LogOptions ¶ added in v0.6.0
LogOptions for LogHandler.Reader.
type LoggingManager ¶ added in v0.6.0
type LoggingManager interface {
ServiceLog(service string) LogHandler
}
LoggingManager provides unified interface to publish and consume logs.
type Machine ¶
type Machine interface { State() MachineState Config() config.MachineConfig }
Machine defines the runtime parameters.
type MachineState ¶
type MachineState interface { Disk() *probe.ProbedBlockDevice Close() error Installed() bool }
MachineState defines the machined state.
type Mode ¶
type Mode int
Mode is a runtime mode.
func (Mode) RequiresInstall ¶ added in v0.6.0
RequiresInstall implements config.RuntimeMode.
type Phase ¶
type Phase struct { Name string Tasks []TaskSetupFunc }
Phase represents a collection of tasks to be performed concurrently.
type Platform ¶
type Platform interface { Name() string Configuration() ([]byte, error) Hostname() ([]byte, error) Mode() Mode ExternalIPs() ([]net.IP, error) KernelArgs() procfs.Parameters }
Platform defines the requirements for a platform.
type Runtime ¶
type Runtime interface { Config() config.Provider SetConfig([]byte) error State() State Events() EventStream Logging() LoggingManager }
Runtime defines the runtime parameters.
type Sequence ¶
type Sequence int
Sequence represents a sequence type.
const ( // SequenceBoot is the boot sequence. SequenceBoot Sequence = iota // SequenceBootstrap is the boot sequence. SequenceBootstrap // SequenceInitialize is the initialize sequence. SequenceInitialize // SequenceInstall is the install sequence. SequenceInstall // SequenceShutdown is the shutdown sequence. SequenceShutdown // SequenceUpgrade is the upgrade sequence. SequenceUpgrade // SequenceReset is the reset sequence. SequenceReset // SequenceReboot is the reboot sequence. SequenceReboot // SequenceRecover is the recover sequence. SequenceRecover // SequenceNoop is the noop sequence. SequenceNoop )
func ParseSequence ¶
ParseSequence returns a `Sequence` that matches the specified string.
nolint: gocyclo
type Sequencer ¶
type Sequencer interface { Boot(Runtime) []Phase Bootstrap(Runtime) []Phase Initialize(Runtime) []Phase Install(Runtime) []Phase Reboot(Runtime) []Phase Recover(Runtime, *machine.RecoverRequest) []Phase Reset(Runtime, *machine.ResetRequest) []Phase Shutdown(Runtime) []Phase Upgrade(Runtime, *machine.UpgradeRequest) []Phase }
Sequencer describes the set of sequences required for the lifecycle management of the operating system.
type State ¶
type State interface { Platform() Platform Machine() MachineState Cluster() ClusterState }
State defines the state.
type TaskExecutionFunc ¶
TaskExecutionFunc defines the function that a task will execute for a specific runtime mode.
type TaskSetupFunc ¶
type TaskSetupFunc func(seq Sequence, data interface{}) (TaskExecutionFunc, string)
TaskSetupFunc defines the function that a task will execute for a specific runtime mode.
type WatchOptionFunc ¶ added in v0.6.0
type WatchOptionFunc func(opts *WatchOptions) error
WatchOptionFunc defines the options for the watcher.
func WithTailDuration ¶ added in v0.6.0
func WithTailDuration(dur time.Duration) WatchOptionFunc
WithTailDuration sets up Watcher to return events with timestamp >= (now - tailDuration).
func WithTailEvents ¶ added in v0.6.0
func WithTailEvents(number int) WatchOptionFunc
WithTailEvents sets up Watcher to return specified number of past events.
If number is negative, all the available past events are returned.
func WithTailID ¶ added in v0.6.0
func WithTailID(id xid.ID) WatchOptionFunc
WithTailID sets up Watcher to return events with ID > TailID.
type WatchOptions ¶ added in v0.6.0
type WatchOptions struct { // Return that many past events. // // If TailEvents is negative, return all the events available. TailEvents int // Start at ID > specified. TailID xid.ID // Start at timestamp Now() - TailDuration. TailDuration time.Duration }
WatchOptions defines options for the watch call.
Only one of TailEvents, TailID or TailDuration should be non-zero.
type Watcher ¶
type Watcher interface {
Watch(WatchFunc, ...WatchOptionFunc) error
}
Watcher defines a runtime event watcher.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package logging provides implementations of runtime.LoggingManager.
|
Package logging provides implementations of runtime.LoggingManager. |
Package v1alpha1 implements a `Runtime`.
|
Package v1alpha1 implements a `Runtime`. |