Documentation
¶
Index ¶
- type CommandSender
- type Config
- type Consistency
- type Engine
- func (e *Engine) CreatePreUpdateSnapshot(ctx context.Context, server *storage.Server, reason string) (*storage.ServerSnapshot, error)
- func (e *Engine) DeleteSnapshot(ctx context.Context, snapshotID string) error
- func (e *Engine) ListSnapshots(ctx context.Context, serverID string) ([]*storage.ServerSnapshot, error)
- func (e *Engine) PruneAllSnapshots(ctx context.Context) (int, error)
- func (e *Engine) PruneSnapshots(ctx context.Context, serverID string) (int, error)
- func (e *Engine) Rollback(ctx context.Context, server *storage.Server, snapshotID string) error
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 ¶
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 ¶
PruneAllSnapshots runs retention pruning across all registered servers.
func (*Engine) PruneSnapshots ¶
PruneSnapshots enforces retention limits (max count and age) for a server.