Expand description
FileStore: file storage with write-through cache + background flusher. Port of Go’s pkg/filestore/blockstore.go, blockstore_cache.go, blockstore_dbops.go.
- Separate SQLite DB from Store (matching Go).
- 64KB parts for efficient partial reads/writes.
- Write-through cache with periodic flush (5s default).
- Background flusher via
tokio::spawn+tokio::time::interval.
Re-exports§
pub use checkpointer::Integrity;pub use core::FileStore;pub use core::DEFAULT_FLUSH_SECS;pub use core::MAX_CACHE_BYTES;pub use truncate_owner::TruncateOwner;pub use types::FileMeta;pub use types::FileOpts;pub use types::MuxFile;pub use zone_txn::ZoneTxn;pub use lines::is_blank_line;pub use counter::normalized_records;pub use counter::AppendPos;pub use counter::Counted;pub use counter::CountedAppend;pub use counter::LineState;pub use counter::TailState;pub use replace::DerivedSnapshot;pub use replace::DerivedView;pub use replace::SnapshotFile;pub use replace::SnapshotReader;
Modules§
- at_rest
- The history store is the only copy of a conversation, so only the person it belongs to may open it (SPEC_HISTORY_COMPACT_FORM_ONLY §7, requirement 1). This module makes the folder that holds the store, and everything in it (the database, its log and shared-memory files, what a repair or a space reclaim leaves beside it), readable and writable by the owning user alone: mode 0700 and 0600 on Linux and macOS, an access list of the user and the system with nothing inherited on Windows.
- cache
- Internal cache structs for FileStore.
- checkpointer
- Background WAL checkpoints for a file-backed [
FileStore] (Phase 5a-3, SPEC_AGENT_PANE_BOUNDED_LIVE_WINDOW_MIGRATION_2026_09_23.md §6.3.7 item 5). - copy
- Copying files from one zone to another inside the database: a fork’s
transcript starts as an exact copy of its parent’s
(
agent_session::fork_history), and a long transcript (gigabytes) must not pass through memory on the way. - core
- FileStore struct and CRUD operations.
- counter
- Per-file line counter and generation (Phase 5a-2, SPEC_AGENT_PANE_BOUNDED_LIVE_WINDOW_MIGRATION_2026_09_23.md §6.3.7).
- deltas
- Codec 2 of a frame: the streaming deltas cleaned out (SPEC_HISTORY_STORE_COMPRESSION_AND_COMPACTION_2026_10_21.md §8).
- erase
- Removing a whole copy of the transcript store so its bytes are gone, not just unlinked.
- frames
- Compressed frames of a file’s parts (SPEC_HISTORY_STORE_COMPRESSION_AND_COMPACTION_2026_10_21.md §4).
- ijson
- FileStore IJson (incremental JSON) operations.
- lines
- The transcript line rule, shared by the
output.idxindexer and the per-file line counter (Phase 5a-2, SPEC_AGENT_PANE_BOUNDED_LIVE_WINDOW_MIGRATION_2026_09_23.md §6.3.7). - off_
worker - Keeps a blocking store call from pinning a runtime worker. docs/specs/SPEC_FILESTORE_STORE_CALLS_OFF_WORKERS_2026_10_19.md
- offset_
ops - FileStore offset-based read/write operations.
- parts
- Reading a file’s parts past a damaged one.
- reclaim
- Giving disk space back (
docs/specs/SPEC_HISTORY_STORE_RECLAIM_SPACE_2026_10_23.md). - repair
- Rebuilding a shared transcript store that SQLite reports as corrupt.
- replace
- Multi-file replace and delete in one transaction (Phase 5a-2b, SPEC_AGENT_PANE_BOUNDED_LIVE_WINDOW_MIGRATION_2026_09_23.md §6.3.7 item 4).
- scrub
- Scrubbing the write-ahead log (SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.md §6.2).
- swap
- The swap that ends a transcript’s migration to the compact form
(
SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.mdsection 9). - trim
- A circular file’s head, given back.
read_at/read_filealready treat acircularfile with amaxsizeas holding only its lastmaxsizebytes (offsets stay absolute), but appends only ever add parts: the rows below the window stay in the database. A terminal’s output is the one stream written at line speed with nobody reading it back (yesstored 2.5 GB), so its file is made circular and its dead head dropped here. - truncate_
owner - Which srv on the machine truncates a shared store’s WAL. Every srv opens the global transcript store, and one TRUNCATE checkpoint every half hour is enough: the first srv to take an advisory lock on a file beside the database keeps it for as long as it runs, and the others leave the job to it. When it exits the operating system drops the lock, and another srv takes it at its next look.
- types
- Wire types matching Go’s wshrpc types for file storage.
- zone_
txn - Read-modify-write of small files in one zone, as one transaction across processes (SPEC_MEMORY_FOLLOWS_THE_AGENT_2026_09_24.md §2.1.1).