snapshot

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandSender added in v1.0.39

type CommandSender interface {
	SendCommand(ctx context.Context, serverID, command string) (string, error)
}

CommandSender sends a console command to a server over RCON.

type Config

type Config struct {
	BackupDir     string
	MaxSnapshots  int // Max pre-update snapshots to retain per server (default: 5)
	RetentionDays int // Max age in days to retain pre-update snapshots (0 = unlimited age)
}

Config holds configuration for the SnapshotEngine

type Consistency added in v1.0.39

type Consistency string

Consistency classifies how consistent an archive taken from a possibly live server can honestly claim to be (OSS-235). A failed save flush is never silently reported as consistent.

const (
	// ConsistencyVerifiedStopped: the server was stopped for the archive.
	ConsistencyVerifiedStopped Consistency = "verified stopped"
	// ConsistencyVerifiedQuiesced: world saves were frozen and flushed before
	// archiving.
	ConsistencyVerifiedQuiesced Consistency = "verified quiesced"
	// ConsistencyCrashConsistent: the files are exactly what the server last
	// wrote; no verified flush happened before archiving.
	ConsistencyCrashConsistent Consistency = "crash-consistent"
)

func QuiesceWorld added in v1.0.39

func QuiesceWorld(ctx context.Context, sender CommandSender, log *logger.Logger, server *storage.Server) (resume func() error, level Consistency)

QuiesceWorld freezes world saves over RCON so the files on disk are stable while they are archived, and reports the consistency level the archive may claim. The returned resume function re-enables saving with a bounded, independent context and reports failure, so a world left in save-off is never silent (OSS-235). Every scheduler, snapshot and pre-update path shares these rules.

type Engine

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

Engine manages volume snapshots, pre-update backups, and rollbacks for servers (MINE-23)

func NewEngine

func NewEngine(store *storage.Store, dockerClient *docker.Client, sender *command.Sender, log *logger.Logger, cfg ...Config) *Engine

NewEngine creates a new SnapshotEngine

func NewEngineWithPool

func NewEngineWithPool(store *storage.Store, dockerClient *docker.Client, pool *docker.ClientPool, sender *command.Sender, log *logger.Logger, cfg ...Config) *Engine

NewEngineWithPool creates a new SnapshotEngine with a multi-node ClientPool. If pool is nil and dockerClient is non-nil, a single-node pool wrapping dockerClient is created.

func (*Engine) CreatePreUpdateSnapshot

func (e *Engine) CreatePreUpdateSnapshot(ctx context.Context, server *storage.Server, reason string) (*storage.ServerSnapshot, error)

CreatePreUpdateSnapshot creates an atomic volume snapshot before updating modpacks or configs

func (*Engine) DeleteSnapshot

func (e *Engine) DeleteSnapshot(ctx context.Context, snapshotID string) error

DeleteSnapshot removes a snapshot from DB and disk

func (*Engine) ListSnapshots

func (e *Engine) ListSnapshots(ctx context.Context, serverID string) ([]*storage.ServerSnapshot, error)

ListSnapshots returns all snapshots for a server

func (*Engine) PruneAllSnapshots

func (e *Engine) PruneAllSnapshots(ctx context.Context) (int, error)

PruneAllSnapshots runs retention pruning across all registered servers.

func (*Engine) PruneSnapshots

func (e *Engine) PruneSnapshots(ctx context.Context, serverID string) (int, error)

PruneSnapshots enforces retention limits (max count and age) for a server.

func (*Engine) Rollback

func (e *Engine) Rollback(ctx context.Context, server *storage.Server, snapshotID string) error

Rollback restores a server to the specified snapshot state

Jump to

Keyboard shortcuts

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