Documentation
¶
Overview ¶
Package selfupdate installs a selected Hikyo release over the current binary.
Index ¶
- func CleanupPrevious() error
- func StagesNightlies() bool
- type Config
- type Installer
- func (i *Installer) Apply(ctx context.Context, status updatecheck.Status) error
- func (i *Installer) AssembleNightlyRoute(ctx context.Context, target PreparedNightly, sources []PreparedNightly) (_ string, err error)
- func (i *Installer) AssembleReleaseRoute(ctx context.Context, target PreparedNightly, sources []PreparedNightly) (_ string, err error)
- func (i *Installer) CheckReplaceable() error
- func (i *Installer) PrepareNightly(ctx context.Context, status updatecheck.Status) (PreparedNightly, error)
- func (i *Installer) PrepareNightlySource(ctx context.Context, status updatecheck.Status, ...) (PreparedNightly, error)
- func (i *Installer) PrepareRelease(ctx context.Context, status updatecheck.Status) (PreparedNightly, error)
- func (i *Installer) PrepareReleaseSource(ctx context.Context, status updatecheck.Status, ...) (PreparedNightly, error)
- func (i *Installer) PruneNightlyCache(ctx context.Context, keep ...releaseidentity.Identity) error
- func (i *Installer) PruneNightlyScratch(ctx context.Context) error
- func (i *Installer) VerifyCachedRelease(ctx context.Context, prepared PreparedNightly, ...) (PreparedNightly, error)
- type PreparedNightly
- type StagedNightly
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupPrevious ¶
func CleanupPrevious() error
CleanupPrevious is a no-op where replacement is one atomic rename.
func StagesNightlies ¶
func StagesNightlies() bool
StagesNightlies reports whether nightly updates only stage verified evidence. On Linux the CLI binary may be a systemd server's executable, which only `sudo hikyo upgrade` may replace after its backup and restore proof. Other platforms have no supported server host, so their CLI replaces itself.
Types ¶
type Config ¶
type Config struct {
StateDir string
TrustRootBase64 string
RecoveryKeyBase64 string
// TransientBundles lets the host coordinator discard superseded private
// bundles while resolving a route. Manual staging keeps published locators.
TransientBundles bool
}
Config carries the trust material stamped into published artifacts. Direct source builds leave it empty because their default update channel is off.
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer downloads, validates, and atomically replaces one Hikyo binary.
func NewInstaller ¶
NewInstaller constructs the production updater with Hikyo's restricted release-download client.
func (*Installer) AssembleNightlyRoute ¶
func (i *Installer) AssembleNightlyRoute(ctx context.Context, target PreparedNightly, sources []PreparedNightly) (_ string, err error)
AssembleNightlyRoute combines exact prepared source/route releases with the target under the current authenticated snapshot. Every flat directory is independently reverified. It does not infer edges or authorize execution; the caller must ask the resulting runtime bundle to plan the actual DB source.
func (*Installer) AssembleReleaseRoute ¶
func (i *Installer) AssembleReleaseRoute(ctx context.Context, target PreparedNightly, sources []PreparedNightly) (_ string, err error)
AssembleReleaseRoute verifies a mixed stable/nightly route without selecting or executing a target. Each identity must already be exact prepared evidence.
func (*Installer) CheckReplaceable ¶
CheckReplaceable reports whether this process can replace the running executable, before any update state or download is written.
func (*Installer) PrepareNightly ¶
func (i *Installer) PrepareNightly(ctx context.Context, status updatecheck.Status) (PreparedNightly, error)
PrepareNightly authenticates a selected immutable nightly, assembles its runtime evidence and extracts this platform's binary without installing it. A target older than the highest observed nightly is refused.
func (*Installer) PrepareNightlySource ¶
func (i *Installer) PrepareNightlySource(ctx context.Context, status updatecheck.Status, expected releaseidentity.Identity) (PreparedNightly, error)
PrepareNightlySource fetches an exact source or route-hop identity selected from authenticated compatibility evidence. Older evidence is allowed, but the durable highest observed nightly and snapshot floor never decrease. The caller must still prove a route before executing any prepared binary.
func (*Installer) PrepareRelease ¶
func (i *Installer) PrepareRelease(ctx context.Context, status updatecheck.Status) (PreparedNightly, error)
PrepareRelease prepares the selected immutable release without installing it. Stable selection deliberately does not follow latest: container callers bind the returned proof and executable digest to their own running build.
func (*Installer) PrepareReleaseSource ¶
func (i *Installer) PrepareReleaseSource(ctx context.Context, status updatecheck.Status, expected releaseidentity.Identity) (PreparedNightly, error)
PrepareReleaseSource permits historical evidence only for an exact identity already selected from authenticated compatibility declarations.
func (*Installer) PruneNightlyCache ¶
PruneNightlyCache removes verified nightly directories, assembled bundles, extracted executables and abandoned staging directories that no kept identity references. Every full nightly is several hundred MiB, and a route with intermediate hops multiplies that, so the cache is trimmed after each completed upgrade. The trust state and lock files are never touched: the state carries the rollback floor and the highest observed release.
func (*Installer) PruneNightlyScratch ¶
PruneNightlyScratch keeps all verified releases and executables while an unfinished journal may still require their exact bytes to resume. Derived private bundles can be rebuilt from those retained releases.
func (*Installer) VerifyCachedRelease ¶
func (i *Installer) VerifyCachedRelease(ctx context.Context, prepared PreparedNightly, floor releaseidentity.SnapshotFloor) (PreparedNightly, error)
VerifyCachedRelease reauthenticates an offline prepared release without discovery or network requests. The descriptor's executable path and digest are untrusted hints: both are replaced by extraction of the signed archive. The caller still binds the returned identity and payload to its running build and enforces the installation's durable migration/admission gate.
type PreparedNightly ¶
type PreparedNightly struct {
Identity releaseidentity.Identity
Directory string
BundleDirectory string
BinaryPath string
BinarySHA256 releaseidentity.Digest
}
PreparedNightly is authenticated public evidence and a separately extracted executable. Preparation never replaces the installed executable or admits a database upgrade; the host controller and runtime gate perform those steps.
type StagedNightly ¶
StagedNightly reports a verified manual-upgrade download on Linux, never replacement of the running executable: it may be a server's, and installing a server also requires its local gate, backup/drill evidence and complete runtime bundle. Other platforms replace the CLI instead (see StagesNightlies).
func (*StagedNightly) Error ¶
func (s *StagedNightly) Error() string