Documentation
¶
Overview ¶
Package update implements the explicit javdb self-update workflow.
Index ¶
- func CleanupPendingWindowsUpdate() error
- func NewReleaseHTTPClient(proxy string) (*http.Client, error)
- type BinaryChecker
- type BinaryCheckerFunc
- type CommandRunner
- type Coordinator
- type CoordinatorOptions
- type GitHubReleaseClient
- type InstallSource
- type Release
- type ReleaseAsset
- type ReleaseChecker
- type ReleaseClientOptions
- type ReleaseInstaller
- type ReleaseInstallerOptions
- type Request
- type Result
- type SourceDetector
- type SourceDetectorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupPendingWindowsUpdate ¶
func CleanupPendingWindowsUpdate() error
CleanupPendingWindowsUpdate has no work outside Windows.
Types ¶
type BinaryChecker ¶
BinaryChecker validates a downloaded binary before it can replace javdb.
type BinaryCheckerFunc ¶
BinaryCheckerFunc adapts a function for installer tests.
type CommandRunner ¶
CommandRunner executes package-manager commands without shell interpolation.
func NewCommandRunner ¶
func NewCommandRunner(stdout, stderr io.Writer) CommandRunner
NewCommandRunner returns the production package-manager runner.
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator chooses a safe update strategy for the detected installation source.
func NewCoordinator ¶
func NewCoordinator(options CoordinatorOptions) (*Coordinator, error)
NewCoordinator validates the dependencies shared by command and tests.
type CoordinatorOptions ¶
type CoordinatorOptions struct {
SourceDetector SourceDetector
ReleaseChecker ReleaseChecker
CommandRunner CommandRunner
ReleaseInstaller ReleaseInstaller
}
CoordinatorOptions provides external dependencies for a testable update flow.
type GitHubReleaseClient ¶
type GitHubReleaseClient struct {
// contains filtered or unexported fields
}
GitHubReleaseClient reads GitHub's public Releases API.
func NewGitHubReleaseClient ¶
func NewGitHubReleaseClient(options ReleaseClientOptions) (*GitHubReleaseClient, error)
NewGitHubReleaseClient constructs an unauthenticated Release reader.
type InstallSource ¶
type InstallSource string
InstallSource describes the package manager or artifact that owns javdb.
const ( InstallSourceDevelopment InstallSource = "development" InstallSourceHomebrew InstallSource = "homebrew" InstallSourceGoInstall InstallSource = "go-install" InstallSourceRelease InstallSource = "release" )
func DetectInstallSource ¶
func DetectInstallSource(info buildinfo.Info) (InstallSource, error)
DetectInstallSource identifies managed binaries before a write is attempted.
type Release ¶
type Release struct {
TagName string `json:"tag_name"`
Prerelease bool `json:"prerelease"`
Assets []ReleaseAsset `json:"assets"`
}
Release is a verified candidate returned by the GitHub Releases API.
type ReleaseAsset ¶
type ReleaseAsset struct {
Name string `json:"name"`
DownloadURL string `json:"browser_download_url"`
}
ReleaseAsset is the subset of GitHub Release asset metadata used by updater.
type ReleaseChecker ¶
ReleaseChecker resolves the highest compatible published GitHub Release.
type ReleaseClientOptions ¶
ReleaseClientOptions exposes the API endpoint for deterministic tests.
type ReleaseInstaller ¶
ReleaseInstaller installs an already selected release for the current platform.
func NewReleaseInstaller ¶
func NewReleaseInstaller(options ReleaseInstallerOptions) ReleaseInstaller
NewReleaseInstaller creates the production archive updater. Every write is delayed until the archive checksum and the embedded binary version both match.
type ReleaseInstallerOptions ¶
type ReleaseInstallerOptions struct {
HTTPClient *http.Client
ExecutablePath func() (string, error)
GOOS string
GOARCH string
BinaryChecker BinaryChecker
Replacer func(string, string) error
AssetURLValidator func(Release, ReleaseAsset) error
}
ReleaseInstallerOptions injects system boundaries for deterministic tests.
type Result ¶
type Result struct {
Source InstallSource `json:"source"`
CurrentVersion string `json:"current_version"`
LatestVersion *string `json:"latest_version"`
LatestPrerelease bool `json:"latest_prerelease"`
UpdateAvailable bool `json:"update_available"`
}
Result is stable status output for human and JSON update checks.
type SourceDetector ¶
type SourceDetector interface {
Detect(buildinfo.Info) (InstallSource, error)
}
SourceDetector determines which installer owns the currently running binary.
type SourceDetectorFunc ¶
type SourceDetectorFunc func(buildinfo.Info) (InstallSource, error)
SourceDetectorFunc adapts a function for coordinator tests and composition.
func (SourceDetectorFunc) Detect ¶
func (f SourceDetectorFunc) Detect(info buildinfo.Info) (InstallSource, error)
Detect calls the wrapped source detector.