Documentation
¶
Index ¶
Constants ¶
const ( ErrAssetNotFound warpnet.WarpError = "release asset not found" ErrChecksumNotFound warpnet.WarpError = "checksum not found" ErrChecksumMismatch warpnet.WarpError = "checksum mismatch" ErrBinaryNotFound warpnet.WarpError = "binary not found in archive" ErrUnexpectedStatus warpnet.WarpError = "unexpected response status" ErrTooLarge warpnet.WarpError = "downloaded data too large" ErrNoReleaseTag warpnet.WarpError = "release has no tag" ErrRestartFailed warpnet.WarpError = "fail restarting" ErrNoPendingUpdate warpnet.WarpError = "no release is waiting for an answer" ErrReleaseUnsigned warpnet.WarpError = "release carries no signature" ErrMalformedKey warpnet.WarpError = "malformed release signing key" ErrNoReleaseSource warpnet.WarpError = "no forge to read releases from" ErrReadOnlyInstall warpnet.WarpError = "the binary cannot be replaced where it is installed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶ added in v0.8.77
type Artifact struct {
AssetName string // archive attached to the release
ChecksumName string // SHA-256 listing of AssetName
SignatureName string // ed25519 signature of ChecksumName
BinaryName string // executable inside the archive
}
Artifact points at the release asset carrying a replacement for the running binary. A zero Artifact means the running platform has no published asset and self-update stays off.
func MemberArtifact ¶ added in v0.8.77
func MemberArtifact() Artifact
func ModeratorArtifact ¶ added in v0.8.77
func ModeratorArtifact() Artifact
ModeratorArtifact returns the moderator asset for the running platform. Releases publish the moderator for linux/amd64 only.
func RelayArtifact ¶ added in v0.8.77
func RelayArtifact() Artifact
RelayArtifact returns the relay asset for the running platform. Releases publish the relay for linux/amd64 only.
type AssetFetcher ¶ added in v0.8.77
type AssetFetcher interface {
// Read returns a small asset, such as a checksum listing.
Read(url string) ([]byte, error)
// Download streams an asset into dstPath and returns its SHA-256.
Download(url, dstPath string) (checksum string, err error)
}
AssetFetcher retrieves release assets.
type BinaryReplacer ¶ added in v0.8.77
type BinaryReplacer interface {
// Path returns where the running binary lives.
Path() string
// StagePath returns a scratch path on the filesystem holding the binary.
StagePath(name string) string
// Install puts the binary at path in place of the running one and returns a
// func rolling back to the previous binary.
Install(path string) (rollback func(), err error)
// Restart hands the process over to the installed binary. On success it does
// not return.
Restart(shutdownF func()) error
}
BinaryReplacer owns the binary of the running process.
type FailureRegistry ¶ added in v0.8.77
FailureRegistry remembers the release that could not replace the binary.
type Release ¶ added in v0.8.77
type Release struct {
Version *semver.Version
URL string // page a human downloads it from
// contains filtered or unexported fields
}
Release is a published release with the assets attached to it.
type ReleaseSource ¶ added in v0.8.77
ReleaseSource resolves the newest published release.
type SelfUpdater ¶ added in v0.8.77
type SelfUpdater struct {
// contains filtered or unexported fields
}
SelfUpdater keeps the running binary in sync with the newest release. A node with an owner to ask - a member node - holds every release until the frontend answers for it; an unattended one installs it right away.
func NewSelfUpdater ¶ added in v0.8.77
func (*SelfUpdater) AnswerUpdate ¶ added in v0.8.77
func (u *SelfUpdater) AnswerUpdate(isAllowed bool) error
func (*SelfUpdater) Close ¶ added in v0.8.77
func (u *SelfUpdater) Close()
func (*SelfUpdater) GetPendingUpdate ¶ added in v0.8.77
func (u *SelfUpdater) GetPendingUpdate() (currentVersion, newVersion, releaseURL string)
func (*SelfUpdater) IsInstallable ¶ added in v0.8.77
func (u *SelfUpdater) IsInstallable() bool
IsInstallable reports whether this copy can replace its own binary. One that cannot - a build owned by the system package manager - still reports a release, so its owner learns of it and installs it the way it was installed.
func (*SelfUpdater) Run ¶ added in v0.8.77
func (u *SelfUpdater) Run(shutdownF func())
Run starts the background update loop. shutdownF releases node resources right before the process is replaced by the new binary; it may be nil.