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
- type ErrInvalid
- type Manager
- func (m *Manager) CopyTarget() *system.RegistryCopy
- func (m *Manager) EndpointChanged(id string)
- func (m *Manager) EndpointInUse(_ context.Context, id string) string
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) S3() *system.RegistryS3
- func (m *Manager) S3Size(ctx context.Context) (size int64, ok bool, err error)
- func (m *Manager) Start(ctx context.Context, to Target, actor string) (Status, error)
- func (m *Manager) Status(ctx context.Context) Status
- type Status
- type Switch
- type Target
Constants ¶
const ( // DriverDisk and DriverS3 are the storage kinds. DriverDisk = "disk" DriverS3 = "s3" )
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 (*Manager) CopyTarget ¶
func (m *Manager) CopyTarget() *system.RegistryCopy
CopyTarget is the temporary registry's storage (nil = not running).
func (*Manager) EndpointChanged ¶
EndpointChanged restarts the registry with new credentials when its endpoint was edited.
func (*Manager) EndpointInUse ¶
EndpointInUse blocks deleting the endpoint the registry keeps images in (or is switching to).
func (*Manager) Load ¶
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).
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.