backuphooks

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package backuphooks materializes its package-local database quiesce-hook contract (db-hooks.cue, embedded at build time) into the generated backup-hooks.json manifest, and gives the node-side backup engine a typed view of it. CUE remains the single source of truth: this package never defines hooks of its own, it only evaluates and transports them.

Index

Constants

View Source
const ManifestFileName = "backup-hooks.json"

ManifestFileName is the artifact name under the generated .stackkit/ metadata directory (mirrors backup-recovery-plan.json).

View Source
const SchemaVersion = "backup-hooks/v1"

SchemaVersion identifies the manifest wire format.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detect

type Detect struct {
	ImagePattern  string `json:"imagePattern,omitempty"`
	VolumePattern string `json:"volumePattern,omitempty"`
	EnvVar        string `json:"envVar,omitempty"`
}

type Hook

type Hook struct {
	Engine    string        `json:"engine"`
	Container string        `json:"container"`
	Detect    Detect        `json:"detect"`
	Sqlite    *SqliteHook   `json:"sqlite,omitempty"`
	Postgres  *PostgresHook `json:"postgres,omitempty"`
	Redis     *RedisHook    `json:"redis,omitempty"`
	Mariadb   *MariadbHook  `json:"mariadb,omitempty"`
	Mongodb   *MongodbHook  `json:"mongodb,omitempty"`
}

Hook mirrors db-hooks.cue #DBHook. Engine-specific blocks are pointers so JSON round-trips stay sparse.

type Manifest

type Manifest struct {
	SchemaVersion string `json:"schemaVersion"`
	Hooks         []Hook `json:"hooks"`
}

Manifest is the generated artifact consumed by the node-side backup_run handler. Hooks carry the concretized CUE defaults so the executor never re-derives contract values.

func Build

func Build() (Manifest, error)

Build evaluates the embedded db-hooks contract and returns the manifest with the builtin hooks and their defaults concretized.

func (Manifest) MarshalIndent

func (m Manifest) MarshalIndent() ([]byte, error)

MarshalIndent renders the manifest in the generated-artifact style (trailing newline, two-space indent) used by backup-recovery-plan.json.

type MariadbHook

type MariadbHook struct {
	User    string `json:"user"`
	OutFile string `json:"outFile"`
}

type MongodbHook

type MongodbHook struct {
	OutDir string `json:"outDir"`
}

type PostgresHook

type PostgresHook struct {
	Database       string `json:"database"`
	User           string `json:"user"`
	OutFile        string `json:"outFile"`
	IncludeGlobals bool   `json:"includeGlobals"`
}

type RedisHook

type RedisHook struct {
	DumpDir       string `json:"dumpDir"`
	BgsaveTimeout int    `json:"bgsaveTimeout"`
	CacheOnly     bool   `json:"cacheOnly"`
}

type SqliteHook

type SqliteHook struct {
	DBFile  string `json:"dbFile"`
	OutFile string `json:"outFile"`
}

Jump to

Keyboard shortcuts

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