Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlite

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sqlite is the default on-disk agent.Durable: a single-file, zero-cgo SQLite journal (via modernc.org/sqlite). It implements named-step memoization — the same primitive as DBOS RunAsStep / ADK RunNode — so an agent run survives a process crash and resumes without re-running completed steps. No cluster, no daemon: one binary + one file. The side-effect-safety layer (agent.Safety / ResumeHalt) sits above this.

Store implements agent.Lister, so single-node crash recovery (agent.Recover) works on the default on-disk store: after a restart it enumerates the journal's runs and re-drives the in-flight ones. It does NOT implement agent.Leaser: cross-process HA lease coordination (one driver per run across nodes) remains Postgres-only, since SQLite is a single-writer, single-node journal. Under a single recoverer this is safe regardless, because memoization makes re-driving at-most-once.

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 agent.Durable.

func Open

func Open(path string) (*Store, error)

Open opens (creating if needed) a SQLite journal at path. Use ":memory:" for an ephemeral store in tests. WAL mode is enabled for concurrent readers alongside the single writer.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying database.

func (*Store) Do

func (s *Store) Do(ctx context.Context, runID, name string, fn func(context.Context) (agent.Record, error)) (agent.Record, error)

Do implements agent.Durable: memoized, named-step execution.

func (*Store) History

func (s *Store) History(ctx context.Context, runID string) ([]agent.Record, error)

History implements agent.Durable: all recorded steps for a run, in order.

func (*Store) Runs

func (s *Store) Runs(ctx context.Context) ([]string, error)

Runs implements agent.Lister: the distinct run IDs the store holds, so agent.Recover can enumerate in-flight runs to re-drive after a restart. This makes single-node crash recovery work on the default on-disk store; cross-process HA leasing (agent.Leaser) remains Postgres-only, since SQLite is a single-writer, single-node journal.

Jump to

Keyboard shortcuts

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