Documentation
¶
Index ¶
- Constants
- func ExtractContainerName(cnt container.Summary) string
- func GetStopSignal(labels map[string]string) string
- func IsArcaneContainer(labels map[string]string) bool
- func IsUpdateDisabled(labels map[string]string) bool
- func SetupMessageOnlyLogFile(dataDir string, filePrefix string, minLevel slog.Level) (*os.File, error)
- func UpdateImplicitRestart(containers []ContainerWithDeps, markedForRestart map[string]bool) []string
- type CheckResult
- type ContainerSorter
- type ContainerWithDeps
- type DigestChecker
- func (c *DigestChecker) CheckImageNeedsUpdate(ctx context.Context, imageRef string) CheckResult
- func (c *DigestChecker) CompareWithPulled(ctx context.Context, containerImageID string, newImageRef string) (bool, error)
- func (c *DigestChecker) GetImageIDsForRef(ctx context.Context, ref string) ([]string, error)
Constants ¶
const ( // Core labels LabelArcane = "com.getarcaneapp.arcane" // Identifies the Arcane container itself LabelUpdater = "com.getarcaneapp.arcane.updater" // Enable/disable updates (true/false) // Dependency labels LabelDependsOn = "com.getarcaneapp.arcane.depends-on" // Comma-separated list of container names this depends on LabelStopSignal = "com.getarcaneapp.arcane.stop-signal" // Custom stop signal (e.g., SIGINT) )
Variables ¶
This section is empty.
Functions ¶
func ExtractContainerName ¶
ExtractContainerName extracts a clean container name from the summary
func GetStopSignal ¶
GetStopSignal returns the custom stop signal if set, otherwise empty string
func IsArcaneContainer ¶
IsArcaneContainer checks if the container is the Arcane application itself
func IsUpdateDisabled ¶
IsUpdateDisabled returns true if the special label is present and evaluates to false. Accepts false/0/no/off (case-insensitive) as "disabled". Default is enabled.
func SetupMessageOnlyLogFile ¶
func SetupMessageOnlyLogFile(dataDir string, filePrefix string, minLevel slog.Level) (*os.File, error)
SetupMessageOnlyLogFile configures slog to write structured logs to stdout and a message-only format to a file under dataDir.
The file format is: <msg> key=value key=value ... (no time/level/source) to keep upgrade logs concise for end users.
func UpdateImplicitRestart ¶
func UpdateImplicitRestart(containers []ContainerWithDeps, markedForRestart map[string]bool) []string
UpdateImplicitRestart marks containers that need to restart because their dependencies are restarting. Returns the names of containers that were marked for implicit restart. Note: This function mutates the containers slice by adding "_arcane_implicit_restart" labels.
Types ¶
type CheckResult ¶
type CheckResult struct {
NeedsUpdate bool
LocalDigest string
RemoteDigest string
Error error
CheckedViaAPI bool // True if we checked via registry API, false if we had to pull
}
CheckResult contains the result of a digest check
type ContainerSorter ¶
type ContainerSorter struct {
// contains filtered or unexported fields
}
ContainerSorter handles topological sorting of containers based on dependencies
func NewContainerSorter ¶
func NewContainerSorter(containers []ContainerWithDeps) *ContainerSorter
NewContainerSorter creates a new sorter for the given containers
func (*ContainerSorter) Sort ¶
func (s *ContainerSorter) Sort() ([]ContainerWithDeps, error)
Sort performs topological sort and returns containers in dependency order Dependencies come first, dependents come later
func (*ContainerSorter) SortReverse ¶
func (s *ContainerSorter) SortReverse() ([]ContainerWithDeps, error)
SortReverse returns containers in reverse dependency order Dependents come first, dependencies come later (for stopping)
type ContainerWithDeps ¶
type ContainerWithDeps struct {
Container container.Summary
Inspect container.InspectResponse
Name string
Links []string // Container names this one links to
DependsOn []string // Explicit dependencies from label
NetworkDeps []string // Implicit dependencies from container network mode
}
ContainerWithDeps represents a container with its dependency information for sorting
func ExtractContainerDeps ¶
func ExtractContainerDeps(ctx context.Context, dcli *client.Client, cnt container.Summary, inspect container.InspectResponse) ContainerWithDeps
ExtractContainerDeps extracts dependency information from a container
type DigestChecker ¶
type DigestChecker struct {
// contains filtered or unexported fields
}
DigestChecker provides methods to check if an image needs updating by comparing digests
func NewDigestChecker ¶
func NewDigestChecker(dcli *client.Client, digestResolver remoteDigestResolver) *DigestChecker
NewDigestChecker creates a new DigestChecker
func (*DigestChecker) CheckImageNeedsUpdate ¶
func (c *DigestChecker) CheckImageNeedsUpdate(ctx context.Context, imageRef string) CheckResult
CheckImageNeedsUpdate checks if an image has a newer version available without pulling Returns true if the remote digest differs from the local digest
func (*DigestChecker) CompareWithPulled ¶
func (c *DigestChecker) CompareWithPulled(ctx context.Context, containerImageID string, newImageRef string) (bool, error)
CompareWithPulled compares the current container's image with a freshly pulled image This is the fallback when HEAD request doesn't work
func (*DigestChecker) GetImageIDsForRef ¶
GetImageIDsForRef returns the image IDs associated with a reference