Documentation
¶
Overview ¶
Package update implements verified binary staging and managed rollout messages.
Index ¶
- Constants
- func AssetName(os, arch string) string
- func Download(ctx context.Context, client *http.Client, url, token, path string, asset Asset) error
- func DownloadPreferred(ctx context.Context, repository, version, gateway, token, path string, ...) error
- func InspectExecutable(ctx context.Context, path string) (buildinfo.Info, error)
- func IsCurrent(info buildinfo.Info, version string, asset Asset) bool
- func Matches(info buildinfo.Info, asset Asset) bool
- func SaveBinary(reader io.Reader, path string, asset Asset) error
- func ShortError(err error) string
- func ValidDigest(value string) bool
- func ValidateExecutable(ctx context.Context, path, version string, asset Asset) error
- func ValidatedExecutable(ctx context.Context, path, version string, asset Asset) (buildinfo.Info, error)
- func Verify(path string, asset Asset) error
- func VerifyReleaseManifest(ctx context.Context, repository, tag string, manifest, proof []byte) error
- type Asset
- type Command
- type Deployment
- type Manifest
- type PruneResult
- type Repository
- func (r *Repository) BeginInstall(id string, participants []string) error
- func (r *Repository) Blob(hash string) string
- func (r *Repository) Current() *Deployment
- func (r *Repository) NodeInstall(id, node string, pending bool) error
- func (r *Repository) Pin(assets []Asset) func()
- func (r *Repository) Prune(ctx context.Context, id string, retained []string) (PruneResult, error)
- func (r *Repository) Publish(manifest Manifest, source string) (*Deployment, error)
- func (r *Repository) SetDeferred(id string, deferred []string) error
- func (r *Repository) SetGatewayState(id, state string) error
- func (r *Repository) SetPhase(id, phase string, cause error) error
- func (r *Repository) Upload(reader io.Reader, asset Asset) error
- func (r *Repository) VerifyPinned(assets []Asset) (func(), error)
- type Selection
- type Status
- type Updater
- type UpdaterOptions
Constants ¶
const GatewaySender = "@gateway"
const MaxBinarySize int64 = 128 << 20
Variables ¶
This section is empty.
Functions ¶
func DownloadPreferred ¶ added in v0.5.1
func DownloadPreferred(ctx context.Context, repository, version, gateway, token, path string, asset Asset) error
DownloadPreferred uses GitHub only for the exact authenticated gateway asset. Gateway storage remains a complete fallback, including for development builds.
func InspectExecutable ¶
func IsCurrent ¶
IsCurrent skips replacement of an already running version, even when a rebuild changes its timestamp or checksum. Matches remains strict for binary validation.
func SaveBinary ¶
SaveBinary never publishes incomplete or unverified data.
func ShortError ¶
func ValidDigest ¶
func ValidateExecutable ¶
func ValidatedExecutable ¶ added in v0.5.7
func ValidatedExecutable(ctx context.Context, path, version string, asset Asset) (buildinfo.Info, error)
ValidatedExecutable reads compatibility only after authenticating the bytes.
func Verify ¶
Verify checks the actual bytes on every call. File metadata is not evidence of integrity: contents can change without changing size or modification time.
func VerifyReleaseManifest ¶ added in v0.4.0
func VerifyReleaseManifest(ctx context.Context, repository, tag string, manifest, proof []byte) error
VerifyReleaseManifest authenticates the exact downloaded bytes against the release workflow at the exact tag. TUF supplies Sigstore's rotating trust roots.
Types ¶
type Deployment ¶
type Deployment struct {
ID string `json:"id"`
Manifest Manifest `json:"manifest"`
Source string `json:"source"`
Phase string `json:"phase"`
Error string `json:"error,omitempty"`
UpdatedAt time.Time `json:"updatedAt"`
Participants []string `json:"participants,omitempty"`
Deferred []string `json:"deferred,omitempty"`
Contract int `json:"contract,omitempty"`
InFlight []string `json:"inFlight,omitempty"`
GatewayState string `json:"gatewayState,omitempty"`
}
type Manifest ¶
type PruneResult ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func OpenRepository ¶
func OpenRepository(dir string) (*Repository, error)
func (*Repository) BeginInstall ¶
func (r *Repository) BeginInstall(id string, participants []string) error
func (*Repository) Blob ¶
func (r *Repository) Blob(hash string) string
func (*Repository) Current ¶
func (r *Repository) Current() *Deployment
func (*Repository) NodeInstall ¶ added in v0.5.7
func (r *Repository) NodeInstall(id, node string, pending bool) error
NodeInstall durably records commit intent, or clears it only after a fresh applied/resumed or explicit failed/resumed acknowledgement. Disconnection is not an acknowledgement and must not unlock publication.
func (*Repository) Pin ¶
func (r *Repository) Pin(assets []Asset) func()
Pin keeps assets available while a release is downloaded and published.
func (*Repository) Prune ¶
func (r *Repository) Prune(ctx context.Context, id string, retained []string) (PruneResult, error)
Prune removes obsolete gateway binaries only after durable rollout completion. Callers must serialize invitation creation and deployment selection with it.
func (*Repository) Publish ¶
func (r *Repository) Publish(manifest Manifest, source string) (*Deployment, error)
func (*Repository) SetDeferred ¶ added in v0.5.1
func (r *Repository) SetDeferred(id string, deferred []string) error
SetDeferred records unavailable participants without claiming their updates succeeded. The selected manifest remains available when they reconnect.
func (*Repository) SetGatewayState ¶ added in v0.5.7
func (r *Repository) SetGatewayState(id, state string) error
func (*Repository) VerifyPinned ¶ added in v0.2.0
func (r *Repository) VerifyPinned(assets []Asset) (func(), error)
VerifyPinned hashes binaries without holding the repository mutex. The returned release function keeps cleanup from deleting them until their durable reference is published. Pins do not authorize unverified bytes.
type Selection ¶ added in v0.5.1
type Selection struct {
ID string `json:"id"`
Manifest Manifest `json:"manifest"`
ReleaseRepo string `json:"releaseRepo,omitempty"`
}
Selection exposes software metadata without cross-fleet rollout identities.
type Status ¶
type Status struct {
Software buildinfo.Info `json:"software"`
StagedSoftware buildinfo.Info `json:"stagedSoftware,omitzero"`
ID string `json:"id,omitempty"`
State string `json:"state"`
Busy bool `json:"busy"`
Paused bool `json:"paused"`
LeaseUntil time.Time `json:"leaseUntil,omitempty"`
Error string `json:"error,omitempty"`
SeenAt time.Time `json:"seenAt"`
}
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater stages gateway-published binaries and applies them under an idle reservation. It is part of the node service, not an AI agent or a separate execution role.
func NewUpdater ¶
func NewUpdater(options UpdaterOptions) (*Updater, error)
type UpdaterOptions ¶
type UpdaterOptions struct {
Gateway, Token, Dir string
CacheDir string // Empty selects the OS machine-wide download cache.
Software buildinfo.Info
Busy func() bool
Pause func() bool
Resume func()
Report func(context.Context, Status) error
Apply func(string) error
}
UpdaterOptions supplies node-owned work admission and restart callbacks.