sqlite

package
v0.0.0-...-a4802bf Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.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 SQLiteOption

type SQLiteOption func(*SQLiteStore)

SQLiteOption is a functional option for configuring a SQLiteStore.

func WithLogger

func WithLogger(logger *slog.Logger) SQLiteOption

WithLogger sets an slog.Logger on the SQLiteStore. All store operations emit structured log events through this logger. If not set, a no-op logger is used and nothing is emitted.

type SQLiteStore

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

SQLiteStore is a durable.Store implementation backed by a local SQLite database. It is safe for concurrent use; the connection pool is limited to one connection to avoid SQLite write-lock contention.

func NewSQLiteStore

func NewSQLiteStore(dbPath string, opts ...SQLiteOption) (*SQLiteStore, error)

NewSQLiteStore opens (or creates) a SQLite database at dbPath and initialises the schema. WAL journal mode, a 5 s busy timeout, NORMAL synchronous writes, foreign key enforcement, and WAL auto-checkpoint every 1000 pages are enabled for reliable concurrent read access alongside single-writer semantics.

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the underlying SQLite database handle. Must be called when the store is no longer needed to release file locks.

func (*SQLiteStore) DeleteTask

func (s *SQLiteStore) DeleteTask(ctx context.Context, taskID string) error

DeleteTask implements durable.Store. Cascades to associated step records.

func (*SQLiteStore) GetTask

func (s *SQLiteStore) GetTask(ctx context.Context, taskID string) (durable.TaskInfo, bool, error)

GetTask implements durable.Store.

func (*SQLiteStore) ListStepIDs

func (s *SQLiteStore) ListStepIDs(ctx context.Context, taskID string) ([]string, error)

ListStepIDs implements durable.Store. Returns step IDs ordered by Seq ascending.

func (*SQLiteStore) ListTasks

func (s *SQLiteStore) ListTasks(ctx context.Context) ([]durable.TaskInfo, error)

ListTasks implements durable.Store.

func (*SQLiteStore) LoadStep

func (s *SQLiteStore) LoadStep(ctx context.Context, taskID, stepID string) (durable.StepRecord, bool, error)

LoadStep implements durable.Store.

func (*SQLiteStore) LoadSteps

func (s *SQLiteStore) LoadSteps(ctx context.Context, taskID string) ([]durable.StepRecord, error)

LoadSteps implements durable.Store. Returns all step records ordered by Seq ascending.

func (*SQLiteStore) PurgeTasks

func (s *SQLiteStore) PurgeTasks(ctx context.Context, status durable.TaskStatus, before time.Time) (int64, error)

PurgeTasks implements durable.Store.

func (*SQLiteStore) SaveStep

func (s *SQLiteStore) SaveStep(ctx context.Context, taskID string, step durable.StepRecord) error

SaveStep implements durable.Store. Performs an upsert keyed on (taskID, step.StepID).

func (*SQLiteStore) SaveTask

func (s *SQLiteStore) SaveTask(ctx context.Context, task durable.TaskInfo) error

SaveTask implements durable.Store. Performs an upsert keyed on task.ID.

Jump to

Keyboard shortcuts

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