Documentation
¶
Overview ¶
Package maintenance coordinates a pause in server writes before a checkpoint.
Processes register participants in shared SQL storage. When an operator requests a pause, participants stop accepting requests, cancel their workers and wait for existing writes to finish before acknowledging. The worker callback must honor cancellation and return only after its writes stop. WaitDrained succeeds only when every registered participant has acknowledged.
Participants never expire automatically: a missed heartbeat does not prove that a process stopped writing. Operators must stop an unreachable process before forgetting it. Cancellation leaves the persistent pause in place; resuming writes requires the matching ownership ticket.
See the recovery guide for the operator workflow: https://github.com/deploymenttheory/go-apple-dm/blob/main/docs/operations/recovery.md
Index ¶
- Variables
- func MigrationSet(d sqlcommon.Dialect) (sqlcommon.MigrationSet, error)
- type Member
- type Participant
- type Status
- type Store
- func (s *Store) Forget(ctx context.Context, ticket, id string, processStopped bool) error
- func (s *Store) Register(ctx context.Context, label string) (*Participant, error)
- func (s *Store) Request(ctx context.Context, ticket string) error
- func (s *Store) Resume(ctx context.Context, ticket string) error
- func (s *Store) Status(ctx context.Context) (Status, error)
- func (s *Store) WaitDrained(ctx context.Context, ticket string) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MigrationSet ¶
func MigrationSet(d sqlcommon.Dialect) (sqlcommon.MigrationSet, error)
MigrationSet exposes the compiled schema for coordinated recovery.
Types ¶
type Participant ¶
type Participant struct {
// contains filtered or unexported fields
}
Participant covers a process's HTTP handlers and background workers. Setup clients register for their entire operation and Close when all writes finish.
func (*Participant) Close ¶
func (p *Participant) Close(ctx context.Context) error
Close is called after Run and all setup operations stop. A failed unregister deliberately leaves the member present, so recovery cannot assume it drained.
func (*Participant) ID ¶
func (p *Participant) ID() string
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func Open ¶
Open optionally initializes the schema. Recovery control clients use false: a server version without participation cannot safely be backed up online.
func (*Store) Forget ¶
Forget requires an explicit assertion that the named process has stopped. Calling this on a running process invalidates the backup's consistency guarantee.