storage

package
v0.0.0-...-447be40 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*SQLiteWriter)

Option configures the writer.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger injects a structured logger into the writer.

func WithMetrics

func WithMetrics(metrics *observability.Metrics) Option

WithMetrics attaches metrics instrumentation.

type SQLiteConfig

type SQLiteConfig struct {
	Path                string
	QueueSize           int
	MaintenanceInterval time.Duration
}

SQLiteConfig holds configuration values for the SQLite writer.

type SQLiteWriter

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

SQLiteWriter persists packets into a SQLite database.

func NewSQLiteWriter

func NewSQLiteWriter(cfg SQLiteConfig, opts ...Option) (*SQLiteWriter, error)

NewSQLiteWriter constructs a writer with the provided configuration.

func (*SQLiteWriter) Start

func (w *SQLiteWriter) Start(ctx context.Context) error

Start opens the database, runs migrations, and begins processing the queue.

func (*SQLiteWriter) Stop

func (w *SQLiteWriter) Stop() error

Stop finalises the writer and closes the database connection.

func (*SQLiteWriter) Store

func (w *SQLiteWriter) Store(ctx context.Context, pkt decode.Packet) error

Store pushes a packet into the queue for asynchronous persistence.

type StartStopper

type StartStopper interface {
	Writer
	Start(ctx context.Context) error
	Stop() error
}

StartStopper represents writers that need explicit lifecycle management.

type Writer

type Writer interface {
	Store(ctx context.Context, pkt decode.Packet) error
}

Writer is the minimal interface required by the pipeline to persist packets.

Jump to

Keyboard shortcuts

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