Documentation
¶
Overview ¶
Package storage is the embedded-database foundation for Jōei's persistent state. It wraps a pure-Go SQLite *sql.DB (modernc.org/sqlite, no cgo) with sensible PRAGMAs and a small per-component migration helper, so several subsystems (telemetry now, runtime settings later) can share one file and version their schema independently.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite connection pool configured for Jōei's persistence needs.
func Open ¶
Open opens (or creates) the SQLite database at path, creating the parent directory if needed, and applies the baseline PRAGMAs (WAL for non-blocking reads, a busy timeout to tolerate brief contention). A single open connection keeps writes serialized, matching internal/cache.
func (*DB) ApplyMigrations ¶
ApplyMigrations runs the ordered migration steps for a named component, tracking how many have been applied in a schema_migrations table so each component versions independently on the shared file. Forward-only and idempotent: steps already applied (index < stored version) are skipped.
type WriterStats ¶ added in v1.1.0
type WriterStats struct {
Capacity, Queued, InFlight, UnsavedItems, LastBatchSize int64
AttemptedItems, AcceptedItems, DroppedFullItems, DroppedClosedItems uint64
AbandonedItems, CommittedItems, Batches, Failures, Retries uint64
OldestAge, LastSuccessAge, CommitTimeTotal, LastCommitDuration time.Duration
}
WriterStats is an in-memory observation of a background writer. Item counts mean events for telemetry and hits for usage; queue/batch sizes mean rows.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package storagetest provides test helpers for SQLite-backed tests.
|
Package storagetest provides test helpers for SQLite-backed tests. |