Documentation
¶
Overview ¶
Package sqlite is a persistent rerun.Store backed by SQLite via the pure-Go, cgo-free driver modernc.org/sqlite, so the result stays a single static binary with no C toolchain required.
Index ¶
- type Store
- func (s *Store) Acquire(ctx context.Context, runID string) (io.Closer, bool, error)
- func (s *Store) Append(ctx context.Context, runID string, l rerun.Log) error
- func (s *Store) CancelRequested(ctx context.Context, runID string) (bool, error)
- func (s *Store) Close() error
- func (s *Store) Create(ctx context.Context, r rerun.Run) error
- func (s *Store) Finish(ctx context.Context, runID string, st rerun.Status) error
- func (s *Store) Incomplete(ctx context.Context) ([]rerun.Run, error)
- func (s *Store) LoadLogs(ctx context.Context, runID string) ([]rerun.Log, error)
- func (s *Store) PopSignal(ctx context.Context, runID, name string) ([]byte, bool, error)
- func (s *Store) PushSignal(ctx context.Context, runID, name string, payload []byte) error
- func (s *Store) RequestCancel(ctx context.Context, runID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a SQLite-backed rerun.Store. The mutex guards a per-run held set that backs Guarder's try-lock, so distinct runs lease independently.
func New ¶
New opens (or creates) the database at path and migrates it to the latest schema. The schema encodes two invariants directly: runs.id is a primary key (no duplicate run) and journal(run_id, seq) is a composite primary key (no two entries at the same position). A v0.1 database is adopted and upgraded in place.
func (*Store) Acquire ¶
Acquire is a non-blocking, per-run try-lock over an in-process held set. SQLite's single-writer I/O is already serialized by the connection cap; the lease's only job is run-level mutual exclusion, so distinct runs lease independently. Two *processes* sharing one SQLite file are not supported for execution — that is what the postgres backend is for — and the journal primary key fences the unsupported case.
func (*Store) Append ¶
Append inserts a journal row, returning rerun.ErrSeqConflict on a duplicate (run, seq) position.
func (*Store) CancelRequested ¶
CancelRequested reports whether a cancel has been recorded for the run.
func (*Store) Create ¶
Create inserts a new run row, returning rerun.ErrRunExists on a duplicate ID.
func (*Store) Incomplete ¶
Incomplete returns every run still Pending or Running.
func (*Store) PushSignal ¶
PushSignal and PopSignal implement rerun.Signaler: a durable, per-run, per-name FIFO mailbox. A signal delivered before the workflow reaches Wait waits in the table until Wait pops it, and survives a crash in between.