Documentation
¶
Overview ¶
Package store owns phpbotscout's single SQLite database.
Index and state share one database: FTS5 for BM25 retrieval, ordinary tables for everything else — sources, documents, and in later phases the audit trail, escalation links and feedback. One daemon means one writer, so SQLite's headline weakness does not apply, and keeping the index in the same transactional store as the state it cites is worth more than the concurrency nobody needs.
The driver is the native one, under cgo. R-OPS-26 permits it, and spec 0012 D2 takes it on measurement: 4.97 ms against 9.00 ms for the query that runs on every question. That was affordable only once 0012 D11 cut the release matrix to Linux — cross-compiling cgo to darwin and windows was the cost that made this look expensive, and nothing requires those targets.
It needs the sqlite_fts5 build tag. Without it the driver compiles WITHOUT FTS5 and every retrieval query fails at runtime with "no such module: fts5" — not at build time. The tag is set in the justfile, in CI and in the release config rather than left to anybody's memory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMigrationsUnordered = errors.NewSentinel("store.migrations_unordered",
"store: migrations are not in ascending version order")
ErrMigrationsUnordered is returned when migrations are not in ascending version order. Applying 3 before 2 leaves a schema nobody can reason about, so it is refused rather than sorted silently — the ordering is a property of the source, and quietly fixing it hides a mistake worth seeing.
var ErrScrubBlocked = errors.NewSentinel("store.scrub_blocked",
"store: another connection is reading, so the old pages are still in the file")
ErrScrubBlocked is returned when another connection kept the checkpoint from completing, so the old pages, and whatever was overwritten in them, are still in the file.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the open database.
func OpenWith ¶
OpenWith opens the database and applies the given migrations. Exported so the migration machinery can be tested against deliberately broken input, which is the only way to know a failure leaves the schema intact.
func (*DB) Conn ¶
Conn exposes the underlying handle.
Deliberately public: the packages that own their own tables write their own SQL, and wrapping every statement in a method here would turn this package into a second query language with none of the first one's tooling.