package store

import "audit2fivew/internal/store"

Package store provides a lightweight SQLite-backed persistence layer for historical AVC denial records.

Index

Types

type Store

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

Store wraps a SQLite database for AVC denial persistence.

func New
func New(path string) (*Store, error)

New opens (or creates) the SQLite database at the given path and initialises the schema. The database uses WAL journal mode for concurrent-read performance.

func (*Store) Close
func (s *Store) Close() error

Close releases the database connection.

func (*Store) List
func (s *Store) List() ([]*avc.Denial, error)

List returns every stored denial ordered by last_seen descending (most recent first).

func (*Store) Upsert
func (s *Store) Upsert(d *avc.Denial) error

Upsert inserts a new denial or, if a denial with the same content hash already exists, bumps its count and updates last_seen. This keeps the database de-duplicated while tracking recurrence.