Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCheckNoUpdate = errors.New("selected target is already running") ErrNewerVersionIsAvailable = errors.New("can't resume current update, there is a newer version available") ErrInvalidOngoingUpdate = errors.New("invalid ongoing update") ErrTargetNotFound = errors.New("target not found") ErrNoMatchingTarget = errors.New("no matching target available") ErrNoUpdateInProgress = errors.New("there is no update in progress") ErrMetaUpdateFailed = errors.New("failed to load or update targets metadata") ErrInvalidActionForState = errors.New("invalid action for update state") )
View Source
var ( ErrFetchFailed = errors.New("download failed") ErrFetchNoSpace = errors.New("download failed, not enough storage space") )
View Source
var ( UpdateModeNewUpdate UpdateMode = "new" UpdateModeResume UpdateMode = "resume" UpdateTypeUpdate UpdateType = "update" UpdateTypeSync UpdateType = "sync" )
View Source
var (
ErrInitFailed = errors.New("update initialization failed")
)
View Source
var (
ErrInstallFailed = errors.New("installation failed")
)
View Source
var (
ErrStartFailed = errors.New("start failed")
)
View Source
var (
ErrStopAppsFailed = fmt.Errorf("stopping apps failed")
)
Functions ¶
This section is empty.
Types ¶
type ActionState ¶
type ActionState interface {
Name() ActionName
Execute(ctx context.Context, updateCtx *UpdateContext) error
}
ActionState interface for all states
type Check ¶
type Check struct {
UpdateTargets bool
AllowNewUpdate bool
Force bool
Action string
AllowedStates []update.State
ToVersion int
SyncCurrent bool
MaxAttempts int
RequireLatest bool
EnableTUF bool
}
func (*Check) Execute ¶
func (s *Check) Execute(ctx context.Context, updateCtx *UpdateContext) error
func (*Check) Name ¶
func (s *Check) Name() ActionName
type Fetch ¶
type Fetch struct {
ProgressHandler compose.FetchProgressFunc
}
func (*Fetch) Execute ¶
func (s *Fetch) Execute(ctx context.Context, updateCtx *UpdateContext) error
func (*Fetch) Name ¶
func (s *Fetch) Name() ActionName
type Init ¶
type Init struct {
CheckState bool
}
func (*Init) Name ¶
func (s *Init) Name() ActionName
type Install ¶
type Install struct {
ProgressHandler compose.InstallProgressFunc
}
func (*Install) Execute ¶
func (s *Install) Execute(ctx context.Context, updateCtx *UpdateContext) error
func (*Install) Name ¶
func (s *Install) Name() ActionName
type InsufficientStorageError ¶ added in v1.1.0
type InsufficientStorageError struct {
UsageInfo *StorageStat
}
func (*InsufficientStorageError) Error ¶ added in v1.1.0
func (e *InsufficientStorageError) Error() string
type Start ¶
type Start struct {
ProgressHandler compose.AppStartProgress
}
func (*Start) Execute ¶
func (s *Start) Execute(ctx context.Context, updateCtx *UpdateContext) error
func (*Start) Name ¶
func (s *Start) Name() ActionName
type Stop ¶ added in v1.0.0
type Stop struct{}
func (*Stop) Execute ¶ added in v1.0.0
func (s *Stop) Execute(ctx context.Context, updateCtx *UpdateContext) error
func (*Stop) Name ¶ added in v1.0.0
func (s *Stop) Name() ActionName
type StorageStat ¶ added in v1.1.0
type UpdateContext ¶
type UpdateContext struct {
UpdateInfo
Config *config.Config
EventSender *events.EventSender
Client *client.GatewayClient
Targets target.Targets
StorageUsage *StorageStat
UpdateRunner update.Runner
}
UpdateContext holds the state machine context
func (*UpdateContext) SendEvent ¶
func (u *UpdateContext) SendEvent(event events.EventTypeValue, eventErr ...error)
type UpdateInfo ¶ added in v1.0.0
type UpdateInfo struct {
TotalStates int
CurrentStateNum int
CurrentState ActionName
FromTarget target.Target
ToTarget target.Target
Mode UpdateMode
Type UpdateType
Size UpdateSize
AppDiff struct {
Remove target.Apps
Add target.Apps
Sync target.Apps
Update target.Apps
UpdateTo target.Apps
}
CurrentStatus *status.CurrentStatus
InitializedAt time.Time
FetchedAt time.Time
AlreadyFetched bool
}
type UpdateMode ¶ added in v1.0.0
type UpdateMode string
UpdateMode defines the update mode, new or resume
type UpdateSize ¶ added in v1.1.0
type UpdateType ¶ added in v1.0.0
type UpdateType string
UpdateType defines the update type, update to another version or sync the current version
Click to show internal directories.
Click to hide internal directories.