audit

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package audit provides an audit log adapter for PostgreSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store реализует core.AuditLog для PostgreSQL.

func New

func New(db *database.SQL, logger *slog.Logger) *Store

New создаёт новый Store.

func (*Store) Save

func (s *Store) Save(ctx context.Context, entry core.AuditEntry) error

Save реализует core.AuditLog.

type Worker

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

Worker читает аудит-события из канала и записывает их в хранилище.

func NewWorker

func NewWorker(store core.AuditLog, bufferSize int, logger *slog.Logger, reg *prometheus.Registry, namespace string) (*Worker, chan<- core.AuditEntry)

NewWorker создаёт воркер с буферизированным каналом. Возвращает воркер и write-end канала для отправки аудит-событий.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Run запускает воркер. Блокирует до закрытия канала entries.

func (*Worker) Shutdown

func (w *Worker) Shutdown(timeout time.Duration) int

Shutdown закрывает канал и ожидает завершения записи с таймаутом. Возвращает количество потерянных событий (0 если все записаны вовремя).

Jump to

Keyboard shortcuts

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