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
- Variables
- type Copier
- func (c Copier) Clear(ctx context.Context) error
- func (c Copier) Discard(ctx context.Context, s dbs.CopySpec) error
- func (c Copier) Progress(ctx context.Context, s dbs.CopySpec) (State, error)
- func (c Copier) Start(ctx context.Context, s dbs.CopySpec) error
- func (c Copier) Stop(ctx context.Context, s dbs.CopySpec) error
- type Docker
- type State
Constants ¶
const Label = "syncloud.copy"
Label marks what a move's copy made; its value names the move.
Variables ¶
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) Discard ¶
Discard removes this move's container and volume of a copy. Anything else is left.
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.