Documentation
¶
Index ¶
- type SQLiteOption
- type SQLiteStore
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) DeleteTask(ctx context.Context, taskID string) error
- func (s *SQLiteStore) GetTask(ctx context.Context, taskID string) (durable.TaskInfo, bool, error)
- func (s *SQLiteStore) ListStepIDs(ctx context.Context, taskID string) ([]string, error)
- func (s *SQLiteStore) ListTasks(ctx context.Context) ([]durable.TaskInfo, error)
- func (s *SQLiteStore) LoadStep(ctx context.Context, taskID, stepID string) (durable.StepRecord, bool, error)
- func (s *SQLiteStore) LoadSteps(ctx context.Context, taskID string) ([]durable.StepRecord, error)
- func (s *SQLiteStore) PurgeTasks(ctx context.Context, status durable.TaskStatus, before time.Time) (int64, error)
- func (s *SQLiteStore) SaveStep(ctx context.Context, taskID string, step durable.StepRecord) error
- func (s *SQLiteStore) SaveTask(ctx context.Context, task durable.TaskInfo) error
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) ListStepIDs ¶
ListStepIDs implements durable.Store. Returns step IDs ordered by Seq ascending.
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).