daemon

package
v0.0.0-...-205da4a Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpgradeByImage represents upgrade chameleon service from image, works as new installation
	UpgradeByImage = iota + 1

	// UpgradeByPatch allows upgrade partial components of chameleon service, such as chameleond and related plugins
	UpgradeByPatch
)
View Source
const PluginStopAndRestart = "PluginStopAndRestart"

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, options ...Option) error

func SetLogLevel

func SetLogLevel(level log.Level)

Types

type Event

type Event = apis.MessageType

type Flag

type Flag uint8

func (Flag) Clear

func (f Flag) Clear(flag Flag)

func (Flag) Has

func (f Flag) Has(flag Flag) bool

func (Flag) Set

func (f Flag) Set(flag Flag)

type Option

type Option interface {
	// contains filtered or unexported methods
}

func Endpoint

func Endpoint(endpoint string) Option

type Plugin

type Plugin interface {
	Name() string
	Stats() PluginStats
	SetStats(PluginStats)
	IsActive() bool
	IsEnabled() bool
	SetEnabled(bool)
	Version(ctx context.Context) (*apis.Version, error)
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Pause(ctx context.Context) error
	Resume(ctx context.Context) error
	Schedule(ctx context.Context, task *apis.Task) error
	Unschedule(ctx context.Context, task *apis.Task) error
	Notify(ctx context.Context, event *apis.Event) error
}

func NewPlugin

func NewPlugin(daemonEndpoint string, config *apis.PluginConfig) (Plugin, error)

type PluginStats

type PluginStats struct {
	State     apis.PluginState
	Memory    int64
	CPU       float64
	Timestamp int64
}

func (PluginStats) Active

func (stats PluginStats) Active() bool

func (PluginStats) Degraded

func (stats PluginStats) Degraded() bool

func (PluginStats) Paused

func (stats PluginStats) Paused() bool

func (PluginStats) Running

func (stats PluginStats) Running() bool

func (PluginStats) Starting

func (stats PluginStats) Starting() bool

func (PluginStats) Stopped

func (stats PluginStats) Stopped() bool

func (PluginStats) Stopping

func (stats PluginStats) Stopping() bool

type State

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

func (*State) Authorize

func (state *State) Authorize(authorized bool)

func (*State) Establish

func (state *State) Establish(established bool)

func (*State) IsAuthorized

func (state *State) IsAuthorized() (authorized bool)

func (*State) IsAvailable

func (state *State) IsAvailable() (available bool)

func (*State) IsEstablished

func (state *State) IsEstablished() (established bool)

func (*State) IsSynchronized

func (state *State) IsSynchronized() (synchronized bool)

func (*State) Synchronize

func (state *State) Synchronize(synchronized bool)

type UpgradeRequest

type UpgradeRequest struct {
	// UUID represents upgrade request task id
	UUID string `json:"uuid"`

	// Mode represents upgrade mode, UpgradeByImage or UpgradeByPatch
	Mode int `json:"mode"`

	// Artifact represents upgrade related assets.
	// UpgradeByImage: Artifact can be tarball name or image name
	// UpgradeByPatch: Artifact should be components upgrade package
	Artifact string `json:"artifact"`

	// Registry represents image registry authorize configure, if UpgradeByImage enabled and
	// pull image from image registry
	Registry *apis.Registry `json:"registry,omitempty"`
}

Jump to

Keyboard shortcuts

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