Documentation
¶
Overview ¶
Package installer authenticates, verifies, installs, activates, and recovers independently released bsbctl plugins.
Index ¶
- type Activator
- type Code
- type Downloader
- type Error
- type FileRecord
- type InstallRequest
- type InstallState
- type InstalledRelease
- type Installer
- func (installer *Installer) Install(ctx context.Context, request InstallRequest) (Result, error)
- func (installer *Installer) InstallFirst(ctx context.Context, request InstallRequest) (Result, error)
- func (installer *Installer) Rollback(ctx context.Context, request RollbackRequest) (Result, error)
- func (installer *Installer) Snapshot(ctx context.Context, pluginID string) (Snapshot, error)
- func (installer *Installer) Update(ctx context.Context, request InstallRequest) (Result, error)
- type Intent
- type Operation
- type Options
- type PackageStore
- type PluginInstallState
- type PluginSnapshot
- type Promotion
- type RecoveryOptions
- type ReleaseRef
- type Result
- type RollbackRequest
- type Snapshot
- type StateStore
- func (store *StateStore) ClearIntent() (localstate.CommitOutcome, error)
- func (store *StateStore) LoadIntent() (*Intent, error)
- func (store *StateStore) LoadState() (InstallState, error)
- func (store *StateStore) WriteIntent(intent Intent) (localstate.CommitOutcome, error)
- func (store *StateStore) WriteState(state InstallState) (localstate.CommitOutcome, error)
- type Status
- type VerifiedPackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
const ( CodeCatalogInvalid Code = "catalog_invalid" CodeDownloadFailed Code = "download_failed" CodePackageInvalid Code = "package_invalid" CodeInstallConflict Code = "install_conflict" CodeStateFailed Code = "state_failed" CodeActivationFailed Code = "activation_failed" CodeRecoveryRequired Code = "recovery_required" CodeNotInstalled Code = "not_installed" )
type Downloader ¶
func (Downloader) Download ¶
func (downloader Downloader) Download(ctx context.Context, directory string, entry catalog.Entry) (result *os.File, resultErr error)
Download returns an authenticated artifact as an open descriptor whose private temporary pathname has been unlinked. The caller owns the descriptor and must close it. The descriptor is initially positioned at the beginning, but consumers may change its offset.
type FileRecord ¶
type InstallRequest ¶
type InstallState ¶
type InstallState struct {
Version int `json:"version"`
CatalogSequence uint64 `json:"catalog_sequence"`
CatalogSHA256 string `json:"catalog_sha256,omitempty"`
Installed map[string]InstalledRelease `json:"installed"`
Plugins map[string]PluginInstallState `json:"plugins"`
}
type InstalledRelease ¶
type InstalledRelease struct {
ID string `json:"id"`
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
Manifest catalog.PackageManifest `json:"manifest"`
ManifestSHA256 string `json:"manifest_sha256"`
Files map[string]FileRecord `json:"files"`
Root string `json:"-"`
}
func (InstalledRelease) Ref ¶
func (release InstalledRelease) Ref() ReleaseRef
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
func (*Installer) InstallFirst ¶
func (installer *Installer) InstallFirst(ctx context.Context, request InstallRequest) (Result, error)
InstallFirst is the public first-install operation. An identical active target is idempotent; a different active target is a conflict.
type Intent ¶
type Intent struct {
Version int `json:"version"`
Kind Operation `json:"kind"`
PluginID string `json:"plugin_id"`
Target InstalledRelease `json:"target"`
Before PluginInstallState `json:"before"`
BeforeCatalogSequence uint64 `json:"before_catalog_sequence"`
BeforeCatalogSHA256 string `json:"before_catalog_sha256,omitempty"`
TargetWasInstalled bool `json:"target_was_installed"`
CatalogSequence uint64 `json:"catalog_sequence"`
CatalogSHA256 string `json:"catalog_sha256,omitempty"`
}
type PackageStore ¶
type PackageStore struct {
// contains filtered or unexported fields
}
func NewPackageStore ¶
func NewPackageStore(root string) *PackageStore
func (*PackageStore) Promote ¶
func (store *PackageStore) Promote(verified VerifiedPackage) (InstalledRelease, Promotion, error)
func (*PackageStore) StagingDir ¶
func (store *PackageStore) StagingDir() (string, error)
func (*PackageStore) VerifyInstalled ¶
func (store *PackageStore) VerifyInstalled(release InstalledRelease) error
type PluginInstallState ¶
type PluginInstallState struct {
Active *ReleaseRef `json:"active,omitempty"`
Previous *ReleaseRef `json:"previous,omitempty"`
}
type PluginSnapshot ¶
type PluginSnapshot struct {
PluginID string `json:"plugin_id"`
Configured bool `json:"configured"`
ConfiguredSource string `json:"configured_source,omitempty"`
ConfiguredVersion string `json:"configured_version,omitempty"`
AppCount int `json:"app_count"`
Active *ReleaseRef `json:"active,omitempty"`
Previous *ReleaseRef `json:"previous,omitempty"`
}
type RecoveryOptions ¶
RecoveryOptions contains only the dependencies needed to reconcile an interrupted installer transaction before the live runtime exists.
type ReleaseRef ¶
type ReleaseRef struct {
ID string `json:"id"`
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
}
func (ReleaseRef) Key ¶
func (ref ReleaseRef) Key() string
type Result ¶
type Result struct {
Status Status `json:"status"`
Release ReleaseRef `json:"release"`
Promotion Promotion `json:"promotion,omitempty"`
IntentOutcome localstate.CommitOutcome `json:"intent_outcome,omitempty"`
ActivationOutcome localstate.CommitOutcome `json:"activation_outcome,omitempty"`
StateOutcome localstate.CommitOutcome `json:"state_outcome,omitempty"`
CleanupOutcome localstate.CommitOutcome `json:"cleanup_outcome,omitempty"`
}
type RollbackRequest ¶
type Snapshot ¶
type Snapshot struct {
CatalogSequence uint64 `json:"catalog_sequence"`
RecoveryRequired bool `json:"recovery_required"`
Plugins []PluginSnapshot `json:"plugins"`
}
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
func NewStateStore ¶
func NewStateStore(root string) *StateStore
func (*StateStore) ClearIntent ¶
func (store *StateStore) ClearIntent() (localstate.CommitOutcome, error)
func (*StateStore) LoadIntent ¶
func (store *StateStore) LoadIntent() (*Intent, error)
func (*StateStore) LoadState ¶
func (store *StateStore) LoadState() (InstallState, error)
func (*StateStore) WriteIntent ¶
func (store *StateStore) WriteIntent(intent Intent) (localstate.CommitOutcome, error)
func (*StateStore) WriteState ¶
func (store *StateStore) WriteState(state InstallState) (localstate.CommitOutcome, error)
type VerifiedPackage ¶
type VerifiedPackage struct {
Root string
Entry catalog.Entry
Manifest catalog.PackageManifest
ManifestSHA256 string
Files map[string]FileRecord
// contains filtered or unexported fields
}
func ExtractAndVerifyFile ¶
func ExtractAndVerifyFile(artifact *os.File, stagingParent string, entry catalog.Entry) (VerifiedPackage, error)
ExtractAndVerifyFile authenticates and extracts from artifact without taking ownership of it. The caller must close artifact; the function seeks it and may leave its offset changed. On success, the returned VerifiedPackage owns staging directory handles and must be closed unless passed to Promote, which closes it before returning.
func (VerifiedPackage) Close ¶
func (verified VerifiedPackage) Close() error
Close releases the verified package's owned directory handles. It is safe to call more than once. A package promoted into the immutable store remains installed; an unpromoted package's staging directory is removed when its original pathname still identifies the owned directory.