update

package
v0.0.0-...-4f79b3b Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: BSD-3-Clause Imports: 25 Imported by: 6

Documentation

Index

Constants

View Source
const (
	UpdatesBucketName = "updates"
)

Variables

View Source
var (
	ErrUpdateNotFound = errors.New("Update not found")
)

Functions

func CountFailedUpdates

func CountFailedUpdates(cfg *compose.Config, clientRef string) (int, error)

func GetFetchProgressPrinter

func GetFetchProgressPrinter(options ...ProgressPrinterOption) func(status *compose.FetchProgress)

func GetInitProgressPrinter

func GetInitProgressPrinter() func(status *InitProgress)

func GetInstallProgressPrinter

func GetInstallProgressPrinter(options ...ProgressPrinterOption) func(status *compose.InstallProgress)

Types

type CompleteOpt

type CompleteOpt func(*CompleteOpts)

func CompleteWithForce

func CompleteWithForce() CompleteOpt

func CompleteWithPruning

func CompleteWithPruning() CompleteOpt

type CompleteOpts

type CompleteOpts struct {
	Prune bool
	Force bool
}

type InitOption

type InitOption func(options *InitOptions)

func WithInitAllowEmptyAppList

func WithInitAllowEmptyAppList(allowEmptyList bool) InitOption

func WithInitCheckStatus

func WithInitCheckStatus(checkStatus bool) InitOption

func WithInitProgress

func WithInitProgress(pf InitProgressFunc) InitOption

type InitOptions

type InitOptions struct {
	ProgressReporter  progress.Reporter[InitProgress]
	AllowEmptyAppList bool // Allow specifying an empty app list, which means updating to "no apps" state, hence removing all current apps.
	CheckStatus       bool // Check the status of the specified apps and move the update state to the state that corresponds to this status.
}

type InitProgress

type InitProgress struct {
	State   InitState
	Current int
	Total   int
}

type InitProgressFunc

type InitProgressFunc func(initProgress *InitProgress)

type InitState

type InitState string
const (
	UpdateInitStateLoadingTree   InitState = "Update:init:loading_tree"
	UpdateInitStateCheckingBlobs InitState = "Update:init:checking_blobs"
)

type ProgressPrinterOption

type ProgressPrinterOption func(*ProgressPrinterOpts)

func WithIndentation

func WithIndentation(indentation int) ProgressPrinterOption

type ProgressPrinterOpts

type ProgressPrinterOpts struct {
	// Indentation specifies the number of spaces to indent each line
	Indentation int
}

type Runner

func GetCurrentUpdate

func GetCurrentUpdate(cfg *compose.Config) (Runner, error)

func NewUpdate

func NewUpdate(cfg *compose.Config, ref string) (Runner, error)

type State

type State string
const (
	StateCreated      State = "update:state:created"
	StateInitializing State = "update:state:initializing"
	StateInitialized  State = "update:state:initialized"
	StateFetching     State = "update:state:fetching"
	StateFetched      State = "update:state:fetched"
	StateInstalling   State = "update:state:installing"
	StateInstalled    State = "update:state:installed"
	StateStarting     State = "update:state:starting"
	StateStarted      State = "update:state:started"
	StateCompleting   State = "update:state:completing"
	StateCompleted    State = "update:state:completed"
	StateFailed       State = "update:state:failed"
	StateCancelling   State = "update:state:cancelling"
	StateCanceled     State = "update:state:canceled"
)

func (State) IsOneOf

func (s State) IsOneOf(states ...State) bool

func (State) String

func (s State) String() string

type Update

type Update struct {
	ID              string                     `json:"id"`
	ClientRef       string                     `json:"client_ref"`
	State           State                      `json:"state"`
	Progress        int                        `json:"progress"`
	CreationTime    time.Time                  `json:"creation_time"`
	InitTime        time.Time                  `json:"init_time"`
	FetchTime       time.Time                  `json:"fetch_time"`
	UpdateTime      time.Time                  `json:"update_time"`
	URIs            []string                   `json:"uris"`
	Blobs           compose.BlobsFetchProgress `json:"blobs"`
	TotalBlobsBytes int64                      `json:"total_blobs_bytes"` // total size of all blobs in bytes
	LoadedImages    map[string]struct{}        `json:"loaded_images"`     // images that have been loaded into the docker storage
	FetchedBytes    int64                      `json:"fetched_bytes"`     // total bytes fetched so far
	FetchedBlobs    int                        `json:"fetched_blobs"`     // number of blobs fetched so far
}

func GetFinalizedUpdate

func GetFinalizedUpdate(cfg *compose.Config) (*Update, error)

func GetLastSuccessfulUpdate

func GetLastSuccessfulUpdate(cfg *compose.Config) (*Update, error)

func GetLastUpdate

func GetLastUpdate(cfg *compose.Config) (*Update, error)

Jump to

Keyboard shortcuts

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