audit

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package audit provides JSONL action logging and rollback lookup helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBatchID added in v0.1.7

func NewBatchID() (string, error)

NewBatchID returns a compact batch identifier for grouping one command invocation.

func SessionIDsForBatchRollback added in v0.1.7

func SessionIDsForBatchRollback(logFile, batchID string) ([]string, error)

SessionIDsForBatchRollback returns unique session IDs soft-deleted by one batch.

func WriteActionLog

func WriteActionLog(logFile string, rec ActionRecord) error

WriteActionLog appends a single JSON line action record to the log file.

Types

type ActionRecord

type ActionRecord struct {
	BatchID       string                 `json:"batch_id,omitempty"`
	Timestamp     time.Time              `json:"timestamp"`
	Action        string                 `json:"action"`
	Simulation    bool                   `json:"simulation"`
	Selector      session.Selector       `json:"selector"`
	MatchedCount  int                    `json:"matched_count"`
	AffectedBytes int64                  `json:"affected_bytes"`
	Sessions      []SessionRef           `json:"sessions"`
	Results       []session.DeleteResult `json:"results"`
	ErrorSummary  string                 `json:"error_summary,omitempty"`
}

ActionRecord is one JSONL audit record for a delete command invocation.

type SessionRef

type SessionRef struct {
	SessionID string `json:"session_id"`
	Path      string `json:"path"`
}

SessionRef records a stable pointer to a session target for audit.

Jump to

Keyboard shortcuts

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