migration

package
v1.53.12 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 7 Imported by: 1 module, 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 migration moves a single (org, namespace) shard between nodes. The protocol is:

  1. Lock the source shard via a consensus barrier (Replicator Propose with Op="lock"). Until the lock-frame is accepted on every replica, the shard remains writable.
  2. WAL-checkpoint and copy the SQLite file to the destination.
  3. Replay any frames whose Seq is >= the last sequence captured at barrier time. (No-op for the local driver, since Propose is synchronous.)
  4. Release the lock with another Propose (Op="unlock"); the destination becomes the live shard owner.

CLI: tasksd migrate [--org <id> [--project <id> [--user <id>]]] --namespace <name> --to <node>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator runs migrations against a Manager + Replicator pair.

func NewCoordinator

func NewCoordinator(mgr *store.Manager, rep replication.Replicator) *Coordinator

NewCoordinator wires a fresh coordinator.

func (*Coordinator) Get

func (c *Coordinator) Get(id string) *Job

Get returns a job by id, or nil if unknown.

func (*Coordinator) List

func (c *Coordinator) List() []Job

List returns every job the coordinator has seen.

func (*Coordinator) Migrate

func (c *Coordinator) Migrate(ctx context.Context, j Job) (*Job, error)

Migrate runs a job synchronously.

type Job

type Job struct {
	ID         string    `json:"id"`
	Principal  string    `json:"principal"` // canonical "org/project/user"
	Namespace  string    `json:"ns"`
	From       string    `json:"from"`
	To         string    `json:"to"`
	Status     Status    `json:"status"`
	Error      string    `json:"error,omitempty"`
	Bytes      int64     `json:"bytes"`
	StartedAt  time.Time `json:"startedAt"`
	FinishedAt time.Time `json:"finishedAt,omitempty"`
}

Job is a single migration unit.

type Status

type Status string

Status reflects a migration's lifecycle.

const (
	StatusPending   Status = "pending"
	StatusLocking   Status = "locking"
	StatusCopying   Status = "copying"
	StatusReplaying Status = "replaying"
	StatusReleased  Status = "released"
	StatusFailed    Status = "failed"
)

Jump to

Keyboard shortcuts

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