erasure

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Overview

Package erasure erases one person's retained records, scope by scope, and reports complete only when every scope asked for is. It owns the order, the idempotence and the partial-failure answer; each scope's work is a Step the caller supplies, because the steps need the API server's locks and stores.

The fences that make an erasure hold across replicas are not built here: a destroyed subject key is revoked by the key store's durable destroyed_at check, and an erased run output by out-o2's tombstone. A Step only calls them.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAvailable = errors.New("erasure: this scope is not available on this server")

ErrNotAvailable is a scope this server has no way to erase.

View Source
var ErrScopeUnknown = errors.New("erasure: scopes must be a non-empty list of known names")

ErrScopeUnknown is the error ParseScopes answers for a name that is no scope and for an empty list.

Functions

func Known

func Known(s Scope) bool

Known reports whether s is a scope.

Types

type IncompleteError

type IncompleteError struct {
	Remaining []Scope
	Done      []Scope
	Cause     error
}

IncompleteError is a partial failure: the scopes in Remaining are not done, the first of them because of Cause. Done lists the ones that are. A retry with the same scopes finishes the rest.

func (*IncompleteError) Error

func (e *IncompleteError) Error() string

func (*IncompleteError) Unwrap

func (e *IncompleteError) Unwrap() error

type Orchestrator

type Orchestrator struct {
	Steps map[Scope]Step
}

Orchestrator runs steps. A scope with no step is not available on this server, and asking for it fails rather than reporting it erased.

func (*Orchestrator) Orchestrate

func (o *Orchestrator) Orchestrate(ctx context.Context, person string, scopes []Scope) (Report, error)

Orchestrate erases person's records in scopes, once each, in the fixed order. It stops at the first scope that fails and returns an *IncompleteError naming that scope and every one after it, so the caller says exactly what is left. A scope that holds nothing for the person is a success: the call is idempotent, and a retry is the way to finish.

type Report

type Report struct {
	// Done lists the scopes that finished, in the order they ran.
	Done []Scope
	// Details holds what each finished step returned.
	Details map[Scope]any
}

Report says what an Orchestrate call did.

type Scope

type Scope string

Scope names one kind of record a person's erasure reaches.

const (
	// Credentials: the person's stored credentials and the key they sit under.
	Credentials Scope = "credentials"
	// AuditPersonalFields: the key every sealed audit field of the person is
	// under, destroyed in every version.
	AuditPersonalFields Scope = "audit_personal_fields"
	// RunTasks: the task text of the person's runs.
	RunTasks Scope = "run_tasks"
	// RunOutputs: the stored output of the person's runs.
	RunOutputs Scope = "run_outputs"
	// Recordings: the person's session recordings. Opt-in: nothing deletes one
	// unless this scope is asked for.
	Recordings Scope = "recordings"
	// Components: the components the person saved, and what the snapshot of
	// every run they defined one for says about it. The run keeps a content-free
	// row, because it is what a revived run is checked against.
	Components Scope = "components"
	// RunSetups: the person's own run templates and their revisions, their
	// group template-manager grants, and their name as the author of shared
	// templates, revisions and grants, which stay without it.
	RunSetups Scope = "run_setups"
	// MaskCopies: the masking manifests of the person's runs, after their live
	// attaches and relays are fenced.
	MaskCopies Scope = "mask_copies"
	// RunnerPools: the person's own Self-Hosted runner pools, deleted (their
	// runners leave them and runs waiting for them end), and their name on
	// every pool of theirs, the deleted ones included.
	RunnerPools Scope = "runner_pools"
	// MemberDrives: the drives the person created for themselves, each deleted
	// with its files through the same path as their own delete. A drive a run
	// still holds fails the scope, naming the drive.
	MemberDrives Scope = "member_drives"
)

func ParseScopes

func ParseScopes(names []string) ([]Scope, error)

ParseScopes turns names into scopes. An empty list or an unknown name is ErrScopeUnknown naming it, so nothing runs on a request that misspelt one.

func Scopes

func Scopes() []Scope

Scopes lists every scope in the order Orchestrate runs them.

type Step

type Step func(ctx context.Context, person string) (detail any, err error)

Step erases one scope for person. It must be idempotent: a retry after a partial failure runs every step again, including the ones that finished. The detail it returns is carried to the caller in Report.Details.

Jump to

Keyboard shortcuts

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