Cotton code
149 lines · 5.2 KB · RustRaw
//! CottonDB's store — one SQLite file per person.//!//! Step 1 of the Rust core.//! Nothing in this crate reads the clock or a random source: every stamping//! function takes `now`, every id takes its bytes from the caller./// The two rows a brand-new file needs before anything can be written into it.pub mod audience;pub mod birth;pub mod canonical;/// The Cotton package: what a database holds, as one `.cottonpkg` file another/// database imports through the mint.pub mod cottonpkg;/// The open bundle: a kit's library as a folder tree other apps open (OPF,/// OPDS, Goodreads CSV, M3U8, OPML …), beside the `.cottonpkg`.pub mod open_bundle;/// An author's own writes, read back out of the tables that hold them — what/// replaced tailing `_ops` at version 8.pub mod changes;pub mod create;/// How far this file has seen each author's writes.pub mod cursors;pub mod derived;pub mod driver;pub mod process_lock;pub mod dump;/// An erase out of the bin leaves no history behind — the one step the fold/// takes for a deleted binned row, in every file.pub mod erase;/// Facts in the fold, and the registry of what folding one sets off.pub mod fact_hooks;pub mod error;pub mod exchange;/// Which file this is and which namespace its derived ids take — the only/// place either is made outside a test.pub mod file_identity;pub mod fold;pub mod fts_fill;pub mod fts_purge;pub mod index_later;/// An OAuth refresh chain's rotations, as facts, and how reuse is read off them.pub mod grant_rotations;/// What a device keeps: the keep rules and the one judge both sides read.pub mod keep;// The link rule (design 5.3): a record in a place never points into Mine.pub mod link_rule;pub mod local_places;/// Nothing waits while it holds a file — the mark every file lock sets and the/// check every wait makes.pub mod held;/// Judge time: the relay's reading carried forward by the continuous clock,/// and the rules for which readings are taken (slice 1).pub mod judge;/// Where a test resolves a path from — the crate directory read at RUN time,/// never the compile-time constant a cached binary carries.pub mod manifest;/// `cotton_media_holdings` — who holds which bytes, and the ONE spelling of/// "who is a live holder": the hold is not dropped and the device is not/// revoked.pub mod media_holdings;/// The budgeted phone cache: which `_media` rows the budget may take, in what/// order, and how many bytes that is.pub mod media_evict;pub mod storage_rules;pub mod media_ledger;/// Media leaves when its last record goes: erasure facts, the dead-key rule.pub mod media_erasure;/// `MEDIA_KEY_HOLDERS` and the `_media_key_names` index of who names a key.pub mod media_keys;pub mod media_unlink;pub mod media_thumbs;/// Separately signed facts binding a member to this database's People row.pub mod member_person;pub mod membership;pub mod meta;pub mod migrate;/// The one way a file of an older schema crosses to this build's: in place,/// from the difference between its flat DDL and this build's, for every stamp/// from the oldest file a shipped build wrote (141). Run by every device's/// open, step by step on a phone.pub mod shape_move;pub mod outbox;/// Every stored phone into libphonenumber's E.164, at each open (22 Oct 2026).pub mod phone_fold;pub mod runner_change;pub mod presence;pub mod protocol;pub mod receipts;/// `_parked` — the writes nobody could fold, kept WHOLE so they can be/// folded again.pub mod rejected;/// Revocation facts and the one reader of a device's standing.pub mod revocation;pub mod schema;pub mod search;/// Which machine serves this database, epoch by epoch.pub mod serving;pub mod serving_handover;pub mod serving_grant;pub mod serving_succession;pub mod signed;pub mod snapshot;pub mod soft_refs;pub mod spans;/// A workspace file for the price of a copy — for the TESTS of the crates that/// depend on this one. `cfg(test)` as well as the feature, so this crate's own/// suite reaches the module: a test no configuration compiles is invisible,/// not skipped.#[cfg(any(test, feature = "test-template"))]pub mod test_template;// Files at a chosen schema version and the synthetic owner file, for the// TESTS of every crate that proves an upgrade. Never in a shipping build.#[cfg(feature = "fixtures")]pub mod fixtures;/// The fixtures the fold, outbox, ledger and search tests share: a file at the/// real v45 shape, with an identity and a workspace row in it.#[cfg(test)]mod test_support;pub use driver::{Driver, Folded, Row};pub use error::{Result, StoreError};pub use manifest::manifest_dir;pub mod media_backup_lock;// The one write path (slice 2a): who asks, where a write is made, and the two// readers that build an op back from bytes or rows.pub mod actor;pub mod mint;pub mod stored;/// Undo of an add: an erase of its own reason, judged once on the device that asks.pub mod take_back;pub mod thread_band;pub mod wire;pub mod device_scope;#[cfg(test)]mod reader_role_tests;/// Read-only world facts on Cotton's server (places, holidays, airports,/// words); never a synced database and never bundled.pub mod published;/// Creator deletion eligibility and the shared thirty-day Bin retention.pub mod database_bin;pub mod server_actions;