Help us shape the future of Go! Take the 2026 Go Developer Survey

recorder

package
v0.0.0-...-23ff3bc Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

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

func New

func New(root string, log *events.Logger, cfg *policy.Config, approvalMode governance.ApprovalMode) (*Recorder, error)

New creates a Recorder that evaluates every filesystem event immediately, synchronously with the triggering fsnotify event. This is what `airlock run` needs: a single short-lived command completes and calls Stop() right after, so revert decisions must not be deferred behind a timer.

func NewDebounced

func NewDebounced(root string, log *events.Logger, cfg *policy.Config, approvalMode governance.ApprovalMode, debounce time.Duration) (*Recorder, error)

NewDebounced is like New but coalesces rapid-fire fsnotify events for the same path within debounce into a single evaluation of the settled state. Intended for long-running sessions (Sentinel) watching real editor/IDE activity, where an atomic save (temp-file write + rename) or a burst of consecutive writes to one path would otherwise generate multiple redundant evaluations/events for what is really one logical change.

func (*Recorder) Seed

func (r *Recorder) Seed() error

Seed populates the before-state cache from the current on-disk content of every non-ignored file under root, before any watching starts. Without this, a file that already existed when the recorder started has no cached "before" — so a later denied write to it would be reverted by deleting it instead of restoring its real prior content (the zero-value cache is only correct for files the recorder itself later observes being created). Best-effort: a file that can't be read simply starts with no baseline, matching prior behavior for that one path.

func (*Recorder) SetPolicy

func (r *Recorder) SetPolicy(cfg *policy.Config)

SetPolicy atomically swaps the policy config the recorder enforces on every subsequent evaluation. Safe to call concurrently with the watch loop (and with debounced evaluations running on their own timer goroutines): reads use the same atomic.Pointer, so an in-flight evaluate() sees either the old or the new config in full, never a partially-updated one. This is what makes Fleet policy reconciliation (internal/cli/sentinel.go) take effect on real enforcement immediately, rather than only updating what Sentinel reports about itself.

func (*Recorder) Start

func (r *Recorder) Start() error

func (*Recorder) Stop

func (r *Recorder) Stop() error

Jump to

Keyboard shortcuts

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