dr

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 8 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 dr keeps every kind of data backed up to the recovery storage (Phase 29b): it turns protection on where it is missing, one change at a time, and reports what is protected and what is at risk.

Index

Constants

View Source
const (
	StateProtected = "protected"
	StateAtRisk    = "at-risk"
	StateNotNeeded = "not-needed"
)

States of an item.

View Source
const Actor = "syncloud"

Actor is who makes the changes this package starts.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backups

type Backups interface {
	Recovery() (backup.Storage, bool)
	Config() (backup.Config, bool)
	Status() backup.Status
	Standby() (reason string, held bool)
}

Backups is the controller's backups.

type Databases

type Databases interface {
	ProtectionItems(ctx context.Context) []Item
	UnprotectedIDs(ctx context.Context) []string
	Protect(ctx context.Context, id string) error
	Rolling(ctx context.Context) bool
}

Databases are the managed databases.

type GitServer

type GitServer interface {
	Status() gitserver.Status
	DumpState() (at, tried time.Time, err error)
}

GitServer is the built-in Git server.

type Item

type Item struct {
	Kind       string     `json:"kind"` // controller | postgres | valkey | gitserver | registry
	ID         string     `json:"id,omitempty"`
	Name       string     `json:"name"`
	Owner      string     `json:"owner,omitempty"` // project/environment of a database
	State      string     `json:"state"`
	Reason     string     `json:"reason,omitempty"`
	Location   string     `json:"location,omitempty"`
	LastBackup *time.Time `json:"lastBackup,omitempty"`
}

Item is one thing that holds data.

type Manager

type Manager struct {
	// Hold reports whether a kind of work waits for a recovery (Phase 29c);
	// may be nil.
	Hold func(kind string) bool
	// NodeAddresses lists the nodes' public addresses (storage on them is
	// inside the cluster).
	NodeAddresses func(ctx context.Context) []string
	// contains filtered or unexported fields
}

func New

func New(b Backups, d Databases, r Registry, g GitServer, log *slog.Logger) *Manager

func (*Manager) Items

func (m *Manager) Items(ctx context.Context) []Item

Items is every thing that holds data and whether it is protected.

func (*Manager) Run

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

Run turns protection on where it is missing, every minute.

func (*Manager) Tick

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

Tick makes at most one change to each kind of data.

type Registry

type Registry interface {
	Status(ctx context.Context) regstorage.Status
	Start(ctx context.Context, to regstorage.Target, actor string) (regstorage.Status, error)
}

Registry is where the registry keeps its images.

Jump to

Keyboard shortcuts

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