backupstore

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package backupstore manages Mooring's own-state backups: a consistent snapshot of the SQLite database (via VACUUM INTO), AES-256-GCM-encrypted with the master key (the chunked, tamper-evident stream from internal/backup), written under the data dir and recorded in a catalog. This is the "recover Mooring onto a fresh box" backup — it carries every app's config, definitions, edge routes, and (already- encrypted) secrets. App-internal data volumes are a separate snapshot type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	ID        string
	CreatedAt int64
	SizeBytes int64
	File      string
	SHA256    string
	Kind      string
	Note      string
}

Record is one catalogued backup.

type Store

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

Store creates, lists, and deletes encrypted state backups.

func New

func New(db *store.DB, dir string, key []byte) *Store

New builds a Store. dir is where archives are written (created 0700 on first use).

func (*Store) Available

func (s *Store) Available() bool

Available reports whether backups can be taken (a valid key is configured).

func (*Store) Create

func (s *Store) Create(ctx context.Context, now time.Time) (Record, error)

Create takes a consistent snapshot of the DB, encrypts it, and records it. The plaintext snapshot exists only transiently (0600, in the 0700 backups dir) and is removed as soon as it's encrypted.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete removes the archive file and the catalog row.

func (*Store) FilePath

func (s *Store) FilePath(r Record) string

FilePath returns the absolute path of a record's archive, confined to the backups dir (the stored file name is always a generated <id>.mbk, never user input).

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (Record, bool, error)

Get returns one record by id (ok=false if absent/malformed).

func (*Store) List

func (s *Store) List(ctx context.Context) ([]Record, error)

List returns catalogued backups, newest first.

Jump to

Keyboard shortcuts

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