sqlite

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

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

func New(path string) *Store

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

func (s *Store) Acquire(ctx context.Context, runID string) (io.Closer, bool, error)

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

func (s *Store) Append(ctx context.Context, runID string, l rerun.Log) error

Append inserts a journal row, returning rerun.ErrSeqConflict on a duplicate (run, seq) position.

func (*Store) CancelRequested

func (s *Store) CancelRequested(ctx context.Context, runID string) (bool, error)

CancelRequested reports whether a cancel has been recorded for the run.

func (*Store) Close

func (s *Store) Close() error

Close releases the underlying database handle.

func (*Store) Create

func (s *Store) Create(ctx context.Context, r rerun.Run) error

Create inserts a new run row, returning rerun.ErrRunExists on a duplicate ID.

func (*Store) Finish

func (s *Store) Finish(ctx context.Context, runID string, st rerun.Status) error

Finish updates a run's status.

func (*Store) Incomplete

func (s *Store) Incomplete(ctx context.Context) ([]rerun.Run, error)

Incomplete returns every run still Pending or Running.

func (*Store) LoadLogs

func (s *Store) LoadLogs(ctx context.Context, runID string) ([]rerun.Log, error)

LoadLogs returns a run's journal entries ordered by sequence.

func (*Store) PopSignal

func (s *Store) PopSignal(ctx context.Context, runID, name string) ([]byte, bool, error)

PopSignal removes and returns the oldest queued signal for (runID, name).

func (*Store) PushSignal

func (s *Store) PushSignal(ctx context.Context, runID, name string, payload []byte) error

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.

func (*Store) RequestCancel

func (s *Store) RequestCancel(ctx context.Context, runID string) error

RequestCancel and CancelRequested implement rerun.Canceller: a durable cancel flag so Cancel can reach a run executing in another process.

Jump to

Keyboard shortcuts

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