precopy

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: 10 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 precopy builds copies of databases on a new server while the old cluster still runs (Phase 29e), each in the volume its database will use. It only ever touches containers and volumes labelled with its move.

Index

Constants

View Source
const Label = "syncloud.copy"

Label marks what a move's copy made; its value names the move.

Variables

View Source
var ErrForeign = errors.New("it exists already and was not made by this move")

ErrForeign: the container or volume a copy needs is not this move's.

Functions

This section is empty.

Types

type Copier

type Copier struct {
	Docker Docker
	// Move names this move on this server: what it made before may be
	// replaced.
	Move string
	// Image is the database image of a PostgreSQL version, present here.
	Image func(version string) string
}

Copier runs a move's copies.

func (Copier) Clear

func (c Copier) Clear(ctx context.Context) error

Clear removes everything this move's copies made before, finished or not.

func (Copier) Discard

func (c Copier) Discard(ctx context.Context, s dbs.CopySpec) error

Discard removes this move's container and volume of a copy. Anything else is left.

func (Copier) Progress

func (c Copier) Progress(ctx context.Context, s dbs.CopySpec) (State, error)

Progress reads a copy's state.

func (Copier) Start

func (c Copier) Start(ctx context.Context, s dbs.CopySpec) error

Start begins a copy from nothing, replacing what this move left before.

func (Copier) Stop

func (c Copier) Stop(ctx context.Context, s dbs.CopySpec) error

Stop ends a copy cleanly and removes its container; the volume stays. An error means the volume is not to be used.

type Docker

type Docker interface {
	VolumeLabels(ctx context.Context, name string) (map[string]string, bool, error)
	CreateVolume(ctx context.Context, name string, labels map[string]string) error
	RemoveVolume(ctx context.Context, name string) error
	Create(ctx context.Context, name string, req docker.CreateRequest) (string, error)
	Start(ctx context.Context, id string) error
	Stop(ctx context.Context, id string, timeout time.Duration) error
	Remove(ctx context.Context, id string) error
	Inspect(ctx context.Context, id string) (docker.ContainerJSON, error)
	Tail(ctx context.Context, id string, n int) ([]docker.LogEntry, error)
	List(ctx context.Context, labels ...string) ([]docker.ContainerSummary, error)
	RemoveVolumes(ctx context.Context, label string) (int, error)
}

Docker is what a copy needs of the Docker engine.

type State

type State struct {
	// LSN is how far it replayed; "" while the base backup is fetched.
	LSN string
	// Mark changes as long as the copy gets anywhere.
	Mark    string
	Running bool
	// Said are its last other lines, for a failure.
	Said string
}

State is how far a copy got.

Jump to

Keyboard shortcuts

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