regstorage

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package regstorage chooses where the private registry keeps its images (Phase 19): the controller's disk (the syncloud-registry volume, the default) or an S3 bucket. Switching copies every image to the new storage through a temporary registry, switches the registry over and only then frees the controller's disk.

Index

Constants

View Source
const (

	// DriverDisk and DriverS3 are the storage kinds.
	DriverDisk = "disk"
	DriverS3   = "s3"
)
View Source
const TopicStatus = "registry.storage"

TopicStatus carries the Status whenever a switch makes progress.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalid

type ErrInvalid struct{ Err error }

ErrInvalid wraps validation errors.

func (ErrInvalid) Error

func (e ErrInvalid) Error() string

type Manager

type Manager struct {

	// Set before Switch is used.
	Sys   *system.Manager
	Maint *regmaint.Manager
	Bus   *events.Bus
	// Main reads the registry, Copy the temporary registry.
	Main, Copy *registry.Browser
	// OnChange re-renders the system tasks.
	OnChange func()
	// contains filtered or unexported fields
}

func New

func New(st *store.Store, s3m *s3.Manager, log *slog.Logger) *Manager

func (*Manager) CopyTarget

func (m *Manager) CopyTarget() *system.RegistryCopy

CopyTarget is the temporary registry's storage (nil = not running).

func (*Manager) EndpointChanged

func (m *Manager) EndpointChanged(id string)

EndpointChanged restarts the registry with new credentials when its endpoint was edited.

func (*Manager) EndpointInUse

func (m *Manager) EndpointInUse(_ context.Context, id string) string

EndpointInUse blocks deleting the endpoint the registry keeps images in (or is switching to).

func (*Manager) Load

func (m *Manager) Load(ctx context.Context) error

Load reads the setting and the endpoint's credentials. Call it before the system tasks start, so the registry never starts on the wrong storage.

func (*Manager) S3

func (m *Manager) S3() *system.RegistryS3

S3 is the registry's S3 storage for its system task (nil = the disk).

func (*Manager) S3Size

func (m *Manager) S3Size(ctx context.Context) (size int64, ok bool, err error)

S3Size measures the S3 storage's layers; ok is false on disk.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, to Target, actor string) (Status, error)

Start validates the target and begins switching to it in the background.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) Status

Status returns the current storage and the running or last switch.

type Status

type Status struct {
	Target
	EndpointName string  `json:"endpointName,omitempty"`
	EndpointURL  string  `json:"endpointUrl,omitempty"`
	Switch       *Switch `json:"switch,omitempty"` // the running or last switch
}

Status is the registry's storage as the API shows it.

type Switch

type Switch struct {
	From      Target                `json:"from"`
	To        Target                `json:"to"`
	State     string                `json:"state"` // running | succeeded | failed
	Step      string                `json:"step"`
	Progress  registry.CopyProgress `json:"progress"`
	Message   string                `json:"message,omitempty"`
	Kept      string                `json:"kept,omitempty"` // where the old images were left (S3)
	Freed     int64                 `json:"freedBytes,omitempty"`
	StartedAt time.Time             `json:"startedAt"`
	EndedAt   *time.Time            `json:"endedAt,omitempty"`
	Actor     string                `json:"actor,omitempty"`
}

Switch is a storage switch, running or finished.

type Target

type Target struct {
	Driver   string `json:"driver"`             // disk | s3
	Endpoint string `json:"endpoint,omitempty"` // S3 endpoint ID (name accepted on input)
	Bucket   string `json:"bucket,omitempty"`
	Prefix   string `json:"prefix,omitempty"`
}

Target is a storage the registry can keep images in.

Jump to

Keyboard shortcuts

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