updater

package
v0.0.0-...-8f9dc6d Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanRollback

func CanRollback(execPath string) bool

func CompleteWindowsReplacement

func CompleteWindowsReplacement(_, _, _, _, _, _, _, _ string, _ int) error

func CompleteWindowsRollback

func CompleteWindowsRollback(string, string, string, int) error

func FetchChecksum

func FetchChecksum(ctx context.Context, client *http.Client, manifestURL, assetName string) (string, error)

func GetCurrentTargetAssetName

func GetCurrentTargetAssetName() string

func GetTargetAssetName

func GetTargetAssetName(goos, goarch string) string

func JournalPath

func JournalPath() (string, error)

func PerformRollback

func PerformRollback(execPath string) (bool, error)

func PerformSelfUpgrade

func PerformSelfUpgrade(opts UpgradeOptions) error

func TargetAsset

func TargetAsset(buildTarget string) (string, error)

func VerifyExecutable

func VerifyExecutable(path, targetVersion string) error

func VerifySelfTest

func VerifySelfTest(path string) error

func WriteCompletion

func WriteCompletion(completion Completion) error

Types

type Completion

type Completion struct {
	TargetVersion string `json:"targetVersion"`
	Outcome       string `json:"outcome"`
	Verification  string `json:"verification"`
	Rollback      string `json:"rollback"`
	Recovery      string `json:"recovery,omitempty"`
	Failure       string `json:"failure,omitempty"`
	CompletedAt   string `json:"completedAt"`
}

func ConsumeCompletion

func ConsumeCompletion() (*Completion, error)

type DownloadProgress

type DownloadProgress struct {
	Bytes   int64   `json:"bytes"`
	Total   int64   `json:"total,omitempty"`
	Percent float64 `json:"percent,omitempty"`
}

type ReplaceFunc

type ReplaceFunc func(executable, candidate, backup, targetVersion, checksum, lockPath, lockToken string, verify VerifyFunc) (bool, error)

type SelfTestFunc

type SelfTestFunc func(path string) error

type UpgradeOptions

type UpgradeOptions struct {
	CurrentExecutablePath string
	UserHome              string
	TargetVersion         string
	DownloadURL           string
	ExpectedChecksum      string
	HTTPClient            *http.Client
	Verify                VerifyFunc
	SelfTest              SelfTestFunc
	Replace               ReplaceFunc
	Progress              func(DownloadProgress)
}

type UpgradeResult

type UpgradeResult struct {
	ExecutablePath   string             `json:"executablePath"`
	PayloadPath      string             `json:"payloadPath,omitempty"`
	PreviousVersion  string             `json:"previousVersion,omitempty"`
	BackupPath       string             `json:"backupPath,omitempty"`
	TargetVersion    string             `json:"targetVersion"`
	LegacyTransition bool               `json:"legacyTransition,omitempty"`
	Recovery         string             `json:"recovery,omitempty"`
	Progress         []DownloadProgress `json:"progress,omitempty"`
}

func Upgrade

func Upgrade(opts UpgradeOptions) (UpgradeResult, error)

type VerifyFunc

type VerifyFunc func(path, targetVersion string) error

Jump to

Keyboard shortcuts

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