updater

package
v1.0.18-0...-26f8a7e Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apply

type Apply interface {
	Download(file io.Reader, checksum []byte) error
	Apply(restart bool) error
}

type ChecksumSource

type ChecksumSource interface {
	GetChecksumForFile(source Source, version string, filename string) ([]byte, error)
}

type Config

type Config struct {
	Source            Source
	File              string
	Checksum          ChecksumSource
	Apply             Apply
	CurrentVersion    *semver.Version
	IncludePrerelease bool
}

type PendingUpdate

type PendingUpdate struct {
	Version    *semver.Version
	Changelogs map[string]string
	Ready      bool
}

type Source

type Source interface {
	GetLatestVersion(includePrereleases bool) (string, error)
	GetChangelogs() (map[string]string, error)
	GetFile(version string, filename string) (io.ReadCloser, int64, error)
}

type UpdateDownloadProgress

type UpdateDownloadProgress struct {
	BytesDownloaded, BytesTotal int64
}

type Updater

type Updater struct {
	PendingUpdate *PendingUpdate

	UpdateFound      utils.EventDispatcher[PendingUpdate]
	DownloadProgress utils.EventDispatcher[UpdateDownloadProgress]
	UpdateReady      utils.EventDispatcher[interface{}]
	// contains filtered or unexported fields
}

func MakeUpdater

func MakeUpdater(config Config) *Updater

func (*Updater) CheckForUpdate

func (u *Updater) CheckForUpdate() error

func (*Updater) OnExit

func (u *Updater) OnExit(restart bool) error

Jump to

Keyboard shortcuts

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