1// Package storage owns a tenant's SQLite database and the transaction boundary2// for event data, projections and durable work intents.3//4// Open creates the database and schema with SQLite WAL mode, full synchronous5// writes, foreign-key enforcement and one database connection. Each method6// uses its context for database work.7//8// Save applies duplicate, deletion and replacement rules, stores searchable9// indexes and inserts durable work intents in one transaction. Callers validate10// events before passing them to storage.11// SaveTx performs the same operation inside a transaction supplied by the12// caller. The caller owns that transaction and commits it after SaveTx13// succeeds. WithTx provides the matching begin, commit and rollback boundary;14// its callback uses the supplied *sql.Tx for all database operations.15//16// Query excludes expired, hidden and pending events and applies recipient17// checks through QueryOptions.Access. It returns events in created-at18// descending order with ID ascending as the stable tie breaker. The tenant19// gate applies the remaining policy and resource visibility rules. After20// reads events by their increasing insertion sequence for cursored21// replication; removed events leave gaps in that sequence.22package storage