Documentation
¶
Overview ¶
Package auditqueue is a durable, queue-backed auditlog.Recorder: Record enqueues the audit entry onto a skit queue (one cheap INSERT on the request path) and a background Worker drains it into the audit core. Use it when audit loss on a crash is unacceptable or to smooth write spikes; for the lowest latency with strict per-model ordering use auditlog.AsyncRecorder instead.
Ordering note: the queue does not guarantee per-model order across consumers. Core.Create retries on a version collision (so no row is lost), but if two changes to one model are processed out of order their stored version order can differ from real time. Run a single consumer, or use AsyncRecorder, when strict ordering matters.
Index ¶
Constants ¶
const Kind = "auditlog.record"
Kind is the queue task kind for audit entries.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder enqueues audit entries onto a queue. It implements auditlog.Recorder.
func NewRecorder ¶
NewRecorder builds a queue-backed recorder.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker drains audit tasks from the queue into the audit core.
type WorkerConfig ¶
type WorkerConfig struct {
// Interval between polls (required, > 0).
Interval time.Duration
// Batch caps tasks claimed per tick (default 100).
Batch int
}
WorkerConfig configures the queue-draining loop.