types

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package types contains the public data contracts for the updater module.

Index

Constants

View Source
const (
	// UpdateTypeDigest identifies an image update where the tag is unchanged but the digest changed.
	UpdateTypeDigest = "digest"
	// UpdateTypeTag identifies an image update where the target tag changes.
	UpdateTypeTag = "tag"
)
View Source
const (
	// ResourceTypeImage is the result resource type for image pull/check work.
	ResourceTypeImage = "image"
	// ResourceTypeContainer is the result resource type for container update work.
	ResourceTypeContainer = "container"
	// ResourceTypeProject is the result resource type for compose project update work.
	ResourceTypeProject = "project"
)
View Source
const (
	// StatusChecked indicates a resource was checked.
	StatusChecked = "checked"
	// StatusUpdated indicates a resource was updated.
	StatusUpdated = "updated"
	// StatusRestarted indicates a resource was restarted because a dependency changed.
	StatusRestarted = "restarted"
	// StatusSkipped indicates a resource was skipped.
	StatusSkipped = "skipped"
	// StatusFailed indicates a resource failed to update.
	StatusFailed = "failed"
	// StatusUpToDate indicates a resource is already up to date.
	StatusUpToDate = "up_to_date"
	// StatusUpdateAvailable indicates an update is available.
	StatusUpdateAvailable = "update_available"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComposeProject

type ComposeProject struct {
	ID   string
	Name string
}

ComposeProject identifies a compose project known to the host application.

type ContextHook

type ContextHook func(context.Context) error

ContextHook is a convenience adapter for context-only callbacks.

type Event

type Event struct {
	Phase        string
	Severity     string
	ResourceID   string
	ResourceName string
	ResourceType string
	Metadata     map[string]any
}

Event describes a generic updater event for host applications.

type HistoryRecord

type HistoryRecord struct {
	ID              string
	ResourceID      string
	ResourceType    string
	ResourceName    string
	Status          string
	StartTime       time.Time
	EndTime         *time.Time
	UpdateAvailable bool
	UpdateApplied   bool
	OldImages       map[string]string
	NewImages       map[string]string
	Error           *string
	Details         map[string]any
}

HistoryRecord is a caller-agnostic persisted updater history row.

type ImageUpdateRecord

type ImageUpdateRecord struct {
	ID             string
	Repository     string
	Tag            string
	HasUpdate      bool
	UpdateType     string
	CurrentVersion string
	LatestVersion  *string
	CurrentDigest  *string
	LatestDigest   *string
	CheckTime      time.Time
	LastError      *string
}

ImageUpdateRecord is a pending image update known to a caller-provided store.

func (ImageUpdateRecord) ImageRef

func (i ImageUpdateRecord) ImageRef() string

ImageRef returns the current image reference represented by the record.

func (ImageUpdateRecord) IsDigestUpdate

func (i ImageUpdateRecord) IsDigestUpdate() bool

IsDigestUpdate reports whether the update is digest-based.

func (ImageUpdateRecord) IsTagUpdate

func (i ImageUpdateRecord) IsTagUpdate() bool

IsTagUpdate reports whether the update is tag-based.

func (ImageUpdateRecord) NeedsUpdate

func (i ImageUpdateRecord) NeedsUpdate() bool

NeedsUpdate reports whether the record indicates a pending update.

func (ImageUpdateRecord) NewImageRef

func (i ImageUpdateRecord) NewImageRef() string

NewImageRef returns the image reference the updater should pull for the record.

type LabelPolicy

type LabelPolicy struct {
	IsUpdateDisabledFunc   func(map[string]string) bool
	IsSelfUpdateTargetFunc func(map[string]string) bool
	IsAgentFunc            func(map[string]string) bool
	IsServerFunc           func(map[string]string) bool
	IsSwarmTaskFunc        func(map[string]string) bool
	StopSignalFunc         func(map[string]string) string
}

LabelPolicy controls update labels, self-update labels, and swarm detection.

func (LabelPolicy) IsAgent

func (p LabelPolicy) IsAgent(labels map[string]string) bool

IsAgent reports whether labels identify an agent self-update target.

func (LabelPolicy) IsSelfUpdateTarget

func (p LabelPolicy) IsSelfUpdateTarget(labels map[string]string) bool

IsSelfUpdateTarget reports whether labels require host self-update handling.

func (LabelPolicy) IsServer

func (p LabelPolicy) IsServer(labels map[string]string) bool

IsServer reports whether labels identify a server self-update target.

func (LabelPolicy) IsSwarmTask

func (p LabelPolicy) IsSwarmTask(labels map[string]string) bool

IsSwarmTask reports whether labels identify a Docker Swarm task container.

func (LabelPolicy) IsUpdateDisabled

func (p LabelPolicy) IsUpdateDisabled(labels map[string]string) bool

IsUpdateDisabled reports whether labels opt the container out of updates.

func (LabelPolicy) StopSignal

func (p LabelPolicy) StopSignal(labels map[string]string) string

StopSignal returns the configured stop signal for a container.

type Notification

type Notification struct {
	ContainerID   string
	ContainerName string
	ImageRef      string
	OldImage      string
	NewImage      string
}

Notification describes a successful container update notification.

type Options

type Options struct {
	Type        string   `json:"type,omitempty"`
	ResourceIDs []string `json:"resourceIds,omitempty"`
	Force       bool     `json:"forceUpdate,omitempty"`
	DryRun      bool     `json:"dryRun,omitempty"`
}

Options configures an updater run.

type ResourceResult

type ResourceResult struct {
	ResourceID      string            `json:"resourceId"`
	ResourceName    string            `json:"resourceName,omitempty"`
	ResourceType    string            `json:"resourceType"`
	Status          string            `json:"status"`
	UpdateAvailable bool              `json:"updateAvailable,omitempty"`
	UpdateApplied   bool              `json:"updateApplied,omitempty"`
	OldImages       map[string]string `json:"oldImages,omitempty"`
	NewImages       map[string]string `json:"newImages,omitempty"`
	Error           string            `json:"error,omitempty"`
	Details         map[string]any    `json:"details,omitempty"`
}

ResourceResult represents the result of an update operation on one resource.

type Result

type Result struct {
	Success    bool             `json:"success,omitempty"`
	Checked    int              `json:"checked"`
	Updated    int              `json:"updated"`
	Restarted  int              `json:"restarted,omitempty"`
	Skipped    int              `json:"skipped"`
	Failed     int              `json:"failed"`
	StartTime  string           `json:"startTime,omitempty"`
	EndTime    string           `json:"endTime,omitempty"`
	Duration   string           `json:"duration"`
	Items      []ResourceResult `json:"items"`
	ActivityID *string          `json:"activityId,omitempty"`
}

Result represents a complete updater run.

type SelfUpdateTarget

type SelfUpdateTarget struct {
	ContainerID   string
	ContainerName string
	InstanceType  string
	Labels        map[string]string
}

SelfUpdateTarget describes a container that should be handled by a host self-updater.

type Status

type Status struct {
	UpdatingContainers int      `json:"updatingContainers"`
	UpdatingProjects   int      `json:"updatingProjects"`
	ContainerIDs       []string `json:"containerIds"`
	ProjectIDs         []string `json:"projectIds"`
}

Status reports resources that are actively being updated by this service instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL