Documentation
¶
Overview ¶
Package command supplies the explicit audit retention operation. Parse before boot; Run borrows the application's configured audit scope and database.
Index ¶
Constants ¶
const DefaultBatch = 500
Variables ¶
This section is empty.
Functions ¶
func Declaration ¶
func Declaration(construct func(foundation.Resolver) (*audit.Scope, error), now clock.Clock) (cli.Declaration, error)
Declaration registers the audit command in the ordinary CLI registry. The constructor resolves the configured scope after boot; parsing does no I/O.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is a validated immutable prune operation. Without --before it uses the recorder's configured retention; with it, the explicit RFC 3339 cutoff, which must not be later than the current time. Without --apply it only counts the matching entries; --apply removes them.
func Parse ¶
Parse parses audit prune arguments without database I/O. It requires a help writer and returns flag.ErrHelp after writing requested help.
func (Command) Run ¶
func (c Command) Run(ctx context.Context, scope *audit.Scope, now clock.Clock, output io.Writer) error
Run counts the entries older than the cutoff or, with --apply, removes them in bounded transactions and reports the committed count, also when a later batch fails. A cutoff later than now is rejected before any database work. It never prints audit payloads.