app

package
v1.76.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package app assembles the backup module as a process of its own (docs/decisions/0071): the storage it reads an installation from, the archive bucket and the age recipients it writes to (or, in the restore role, the age identity it reads with), the audit trail, and the job that runs under the backup lease (internal/backup/job). It has no listener and no inbound API but the module-call methods of internal/backup/rpc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Creator

func Creator() string

Creator names this build in each manifest.

Types

type App

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

App is the assembled module.

func New

func New(ctx context.Context, cfg Config, log *slog.Logger) (*App, error)

New assembles the module: the ports, the archive, the key, the audit trail.

func (*App) Close

func (a *App) Close() error

Close closes the audit emitter, which delivers what its queue holds within its timeout and drops the rest, and the ports.

func (*App) Flush

func (a *App) Flush(ctx context.Context) error

Flush delivers the audit records still queued: a Lambda function calls it before an invocation returns, since the process is frozen after it.

func (*App) List

func (a *App) List(ctx context.Context) ([]job.Info, error)

List is the backups in the archive, newest first.

func (*App) PreviewRestore

func (a *App) PreviewRestore(ctx context.Context, backupID string) (*restore.Report, error)

PreviewRestore reports what restoring a backup would do and writes nothing.

func (*App) Prune

func (a *App) Prune(ctx context.Context, actor audit.Actor, dryRun bool) (job.Pass, string, error)

Prune applies the retention rule.

func (*App) RPC

func (a *App) RPC() *modcall.Server

RPC is the module's server: what a transport of internal/modcall serves.

func (*App) Restore

func (a *App) Restore(ctx context.Context, req restorejob.Request) (restorejob.Result, error)

Restore starts a restore or continues the unfinished one, see restorejob.Job.Start. Only the restore role has one.

func (*App) RestoreStatus

func (a *App) RestoreStatus(ctx context.Context) (restorejob.Status, error)

RestoreStatus is the latest restores and the maintenance flags.

func (*App) Role

func (a *App) Role() string

Role is the function the app acts as: backup or restore.

func (*App) Run

func (a *App) Run(ctx context.Context, req job.Request) (job.Result, error)

Run runs one backup (or continues one), see job.Job.Run.

func (*App) Status

func (a *App) Status(ctx context.Context) (job.Status, error)

Status is the latest records.

func (*App) Verify added in v1.76.1

func (a *App) Verify(ctx context.Context, id string, ids []age.Identity) (Verification, error)

Verify reads a backup and checks its object against its sidecar; with identities it also decrypts it and checks every member against the manifest. It writes nothing and takes no lease.

type Config

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

Config is what the module is made of, built from its document.

func FromDocument

func FromDocument(doc *config.SluisBackup) (Config, error)

FromDocument builds the settings from the document already read.

func Load

func Load(file string) (Config, error)

Load reads the module's document and builds the settings. Opening connects to nothing.

func (Config) AsRole

func (c Config) AsRole(role string) Config

AsRole is the configuration acting as role: the command line's `sluis restore` is the restore role whatever the document says.

func (Config) AuditConfig

func (c Config) AuditConfig(ctx context.Context, log *slog.Logger) (audit.Config, error)

AuditConfig is the audit configuration the module runs with, from the adapter table its document resolves to. It opens nothing; a document whose audit adapter the build does not serve, or whose settings it does not decode, is refused here as it is at start.

func (Config) LogLevel

func (c Config) LogLevel() slog.Level

LogLevel is the level the process should log at.

func (Config) Role

func (c Config) Role() string

Role is config.BackupRoleBackup or config.BackupRoleRestore.

type Verification added in v1.76.1

type Verification struct {
	ID string `json:"id"`
	// Object is the encrypted object as its sidecar describes it; its size
	// and SHA-256 matched.
	Object backup.ObjectInfo `json:"object"`
	// Decrypted is whether an identity was given and the archive decrypted,
	// and every member matched the manifest.
	Decrypted bool  `json:"decrypted"`
	Modules   int   `json:"modules"`
	Records   int64 `json:"records"`
	Files     int   `json:"files,omitempty"`
}

Verification is what `sluis backup verify` found.

Jump to

Keyboard shortcuts

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