operator

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package operator is the repair CLIs' audited path (single-owner M4-4). A mutating run as the repair role opens an operator action (a row in operator_actions, with a role label and a reason, never a name), connects with that action's id as the session setting rivolt.operator_action, and closes the action with its outcome. The database trigger (migration 0108) refuses every write by the repair role that does not carry an open action, so a run that skipped this fails at its first write instead of leaving no trace.

The environment decides the path:

RIVOLT_REPAIR_DATABASE_URL  the repair role's DSN. Set: the audited path. Unset: the legacy path (DATABASE_URL, no audit row) with a warning,
                            unless RIVOLT_REPAIR_REQUIRE_ROLE=1, which refuses it.
RIVOLT_OPERATOR_ROLE        lead or owner (the audit row's label); required on the audited path when mutating
RIVOLT_REPAIR_REASON        why this run (at most 300 characters); required on the audited path when mutating
RIVOLT_APPROVED_DIGEST      the sha256 of the approved dry run (64 hex), unless the CLI passes its own --expect-sha; required when mutating

A dry run needs no audit row (it reads), and uses the repair role's DSN when one is set.

Index

Constants

View Source
const (
	EnvDSN         = "RIVOLT_REPAIR_DATABASE_URL"
	EnvRole        = "RIVOLT_OPERATOR_ROLE"
	EnvReason      = "RIVOLT_REPAIR_REASON"
	EnvDigest      = "RIVOLT_APPROVED_DIGEST"
	EnvRequireRole = "RIVOLT_REPAIR_REQUIRE_ROLE"
)

Environment variable names.

Variables

This section is empty.

Functions

This section is empty.

Types

type Run

type Run struct {
	Pool *sql.DB
	// contains filtered or unexported fields
}

Run is an open repair run. Done closes the audit row (a no-op on the legacy path and on a dry run).

func Open

func Open(ctx context.Context, tool string, mutate bool, digest string, getenv func(string) string, legacyDSN string, warn io.Writer) (*Run, error)

Open returns the pool a repair CLI works on. mutate is true for --apply (and a restore's --apply). digest is the approved dry run's sha256 (the CLI's --expect-sha); empty falls back to RIVOLT_APPROVED_DIGEST. legacyDSN is the DSN of today's path. warn receives the legacy-path warning (the CLI's stderr).

func (*Run) Done

func (r *Run) Done(runErr error) error

Done closes the run with the error it ended with (nil: ok). The row count is the database's own (the guard counts each row written), so the CLI does not report one. Call it once.

Jump to

Keyboard shortcuts

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