accesslog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPHandler

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

func NewHTTPHandler

func NewHTTPHandler(repo denyReasonsLister, logger *slog.Logger) *HTTPHandler

type Repository

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

Repository owns the access log write path and simple single-table reads. Cross-domain reads (e.g. joining devices for device_name) live in internal/queries.

func NewRepository

func NewRepository(db *database.DB) *Repository

func (*Repository) BatchInsert

func (r *Repository) BatchInsert(ctx context.Context, events []policy.DecisionEvent) error

func (*Repository) ListDenyReasons

func (r *Repository) ListDenyReasons(ctx context.Context) ([]string, error)

type Sink

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

Sink receives DecisionEvents on a buffered channel and batch-inserts them.

func NewSink

func NewSink(repo repository, logger *slog.Logger) *Sink

func (*Sink) OnDecision

func (s *Sink) OnDecision(_ context.Context, e policy.DecisionEvent)

OnDecision implements policy.DecisionObserver.

func (*Sink) Run

func (s *Sink) Run(ctx context.Context) error

Run processes the channel until ctx is cancelled, flushing on interval or batch fill. Flush interval: 2s. Batch size: 50 events. On context cancellation Run drains the channel and performs a final flush before returning.

Jump to

Keyboard shortcuts

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