Documentation
¶
Overview ¶
Package upgrade provides automatic update functionality for csghub-lite
Index ¶
- func Apply(result *Result, progress ProgressFunc) error
- func ApplyWithVersion(result *Result, progress ProgressFunc) error
- func Restart() error
- func RestartAfter(delay time.Duration) error
- func SetVersion(v string)
- type GitHubRelease
- type GitLabPackage
- type Progress
- type ProgressFunc
- type Region
- type Result
- type Updater
- func (u *Updater) CheckForUpdate(ctx context.Context) (*Result, error)
- func (u *Updater) GetLatestVersion(ctx context.Context) (string, error)
- func (u *Updater) PerformUpgrade(ctx context.Context, result *Result) error
- func (u *Updater) PerformUpgradeWithProgress(ctx context.Context, result *Result, progress ProgressFunc) error
- func (u *Updater) WithRegion(region Region) *Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(result *Result, progress ProgressFunc) error
Apply downloads and installs the update
func ApplyWithVersion ¶
func ApplyWithVersion(result *Result, progress ProgressFunc) error
ApplyWithVersion applies the update with version context
func RestartAfter ¶
RestartAfter starts a replacement process and exits the current process after delay. On Unix, a small shell helper waits for this process to exit before starting the new binary so the server port can be rebound cleanly.
Types ¶
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
PublishedAt time.Time `json:"published_at"`
Assets []struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
} `json:"assets"`
}
GitHubRelease represents a GitHub release
type GitLabPackage ¶
GitLabPackage represents a GitLab package
type ProgressFunc ¶
type ProgressFunc func(Progress)
ProgressFunc is a callback for download progress
type Result ¶
type Result struct {
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
Available bool `json:"available"`
ReleaseNotes string `json:"release_notes"`
PublishedAt time.Time `json:"published_at"`
DownloadURL string `json:"download_url"`
GitLabMirrorURL string `json:"gitlab_mirror_url"`
}
Result contains information about an available update
func CheckWithVersion ¶
CheckWithVersion checks if a new version is available for a specific version
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater handles the upgrade process
func NewUpdater ¶
NewUpdater creates a new Updater instance
func (*Updater) CheckForUpdate ¶
CheckForUpdate checks if a new version is available
func (*Updater) GetLatestVersion ¶
GetLatestVersion fetches the latest version string
func (*Updater) PerformUpgrade ¶
PerformUpgrade downloads and installs the latest version
func (*Updater) PerformUpgradeWithProgress ¶
func (u *Updater) PerformUpgradeWithProgress(ctx context.Context, result *Result, progress ProgressFunc) error
PerformUpgradeWithProgress downloads and installs the latest version with progress callback
func (*Updater) WithRegion ¶
WithRegion sets a specific region for the updater