Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(srcPath, dstPath string) error
- func DelayedRestart(delay time.Duration)
- func DisableUpdateSchedule() error
- func GetFile(identifier string) (*updater.File, error)
- func GetPlatformFile(identifier string) (*updater.File, error)
- func IsRestarting() bool
- func RestartNow()
- func RootPath() string
- func TriggerRestartIfPending()
- func TriggerUpdate(force bool) error
- type SimpleVersions
- type SimplifiedResourceVersion
- type Versions
Constants ¶
const ( // ModuleName is the name of the update module // and can be used when declaring module dependencies. ModuleName = "updates" // VersionUpdateEvent is emitted every time a new // version of a monitored resource is selected. // During module initialization VersionUpdateEvent // is also emitted. VersionUpdateEvent = "active version update" // ResourceUpdateEvent is emitted every time the // updater successfully performed a resource update. // ResourceUpdateEvent is emitted even if no new // versions are available. Subscribers are expected // to check if new versions of their resources are // available by checking File.UpgradeAvailable(). ResourceUpdateEvent = "resource update" )
const (
// RestartExitCode will instruct portmaster-start to restart the process immediately, potentially with a new version.
RestartExitCode = 23
)
Variables ¶
var ( // UserAgent is an HTTP User-Agent that is used to add // more context to requests made by the registry when // fetching resources from the update server. UserAgent = "Core" )
Functions ¶
func CopyFile ¶ added in v0.4.4
CopyFile atomically copies a file using the update registry's tmp dir.
func DelayedRestart ¶ added in v0.5.2
DelayedRestart triggers a restart of the application by shutting down the module system gracefully and returning with RestartExitCode. The restart may be further delayed by up to 10 minutes by the internal task scheduling system. This only works if the process is managed by portmaster-start.
func DisableUpdateSchedule ¶ added in v0.4.0
func DisableUpdateSchedule() error
DisableUpdateSchedule disables the update schedule. If called, updates are only checked when TriggerUpdate() is called.
func GetPlatformFile ¶
GetPlatformFile returns the latest platform specific file identified by the given identifier.
func IsRestarting ¶ added in v0.7.6
func IsRestarting() bool
IsRestarting returns whether a restart is pending or currently in progress.
func RestartNow ¶ added in v0.5.2
func RestartNow()
RestartNow immediately executes a restart. This only works if the process is managed by portmaster-start.
func RootPath ¶ added in v0.6.5
func RootPath() string
RootPath returns the root path used for storing updates.
func TriggerRestartIfPending ¶ added in v0.5.2
func TriggerRestartIfPending()
TriggerRestartIfPending triggers an automatic restart, if one is pending. This can be used to prepone a scheduled restart if the conditions are preferable.
func TriggerUpdate ¶ added in v0.4.0
TriggerUpdate queues the update task to execute ASAP.
Types ¶
type SimpleVersions ¶ added in v0.9.0
type SimpleVersions struct { record.Base sync.Mutex Build *info.Info Resources map[string]*SimplifiedResourceVersion Channel string }
SimpleVersions holds simplified update versions and status information.
func GetSimpleVersions ¶ added in v0.9.0
func GetSimpleVersions() *SimpleVersions
GetSimpleVersions returns the simplified update versions and status information.
type SimplifiedResourceVersion ¶ added in v0.9.0
type SimplifiedResourceVersion struct {
Version string
}
SimplifiedResourceVersion holds version information about one resource.
type Versions ¶ added in v0.9.0
type Versions struct { record.Base sync.Mutex Core *info.Info Resources map[string]*updater.Resource Channel string Beta bool Staging bool }
Versions holds update versions and status information.
func GetVersions ¶ added in v0.9.0
func GetVersions() *Versions
GetVersions returns the update versions and status information. Resources must be locked when accessed.