Documentation
¶
Overview ¶
Package statestore owns the shared SQLite database that jungi keeps under <repo>/.jungi/state/state.db. It is intentionally thin: it resolves the database path, ensures the state directory exists, opens the connection with the pragmas every consumer relies on (busy_timeout for cross-session contention, foreign_keys for cascade integrity), and hands back a handle.
State-owning packages (planengine, tasklist, ...) do not open their own database; they accept a *statestore.DB and bootstrap their own tables into the shared connection via CREATE TABLE IF NOT EXISTS. This keeps a single connection pool per repo and lets a future standalone task-list path share the same file without a second open.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a handle to the shared state database. It carries the repo root it was opened against so consumers (renderers, tool dispatchers) can resolve sibling artifact paths without threading the root separately.
func Open ¶
Open returns a DB bound to repoRoot, creating .jungi/state/ on demand and opening state.db with the busy_timeout and foreign_keys pragmas. A fresh repo gets an empty database; consumers create their own tables via their Bootstrap methods.
repoRoot must be an absolute path. The caller (session.Manager) has already validated it via worktree.RepoRoot.
func (*DB) Close ¶
Close releases the underlying connection pool. Safe to call on a nil receiver so Session.Close need not branch on whether a store was successfully opened.
func (*DB) RepoRoot ¶
RepoRoot returns the repo root the handle was opened against. Renderers and tool dispatchers use it to resolve artifact paths (e.g. plan.md).
Source Files
¶
- paths.go
- statestore.go