This commit introduces significant refinements across the codebase. Core indexing logic is updated with hard constraints on k-mer length, statistical modeling clarifications, and the implementation of the Karlin & Ost theory for chance-collision statistics. Session management features are enhanced with robust memoization capabilities, atomic file operations, per-key locking, and memory mapping support. Additionally, documentation is updated, including a new citation style, and new mathematical notebook support is added.
35 lines
1.6 KiB
Rust
35 lines
1.6 KiB
Rust
//! Domain-agnostic session persistence: a named directory that survives
|
|
//! across separate CLI invocations, holding an opaque parameter blob (used
|
|
//! to detect stale/mismatched reuse) plus a checksummed cache of named
|
|
//! binary artifacts.
|
|
//!
|
|
//! Deliberately knows nothing about what the parameters or artifacts
|
|
//! *mean* — no k-mer/genome/tally concept anywhere in this crate. A
|
|
//! caller (e.g. `obikphylo`, for its `--session` support around
|
|
//! `PairwiseTally`/`PartitionDispersion`/`SnpAlignment`) serializes its own
|
|
//! parameter struct and artifacts to bytes however it likes (`rkyv`,
|
|
//! `bincode`, ...) and hands raw `&[u8]` to this crate; [`Session`] only
|
|
//! deals in byte blobs, directory lifecycle, and locking. Same split
|
|
//! already used elsewhere in this project between a generic mechanism
|
|
//! crate and the domain crate that plugs into it (`obisys`/`obikindex`,
|
|
//! `obicompactvec`/`obikindexer`).
|
|
//!
|
|
//! ## Memoization
|
|
//!
|
|
//! [`Session::memoize`] returns a [`Memoize`] handle that lets callers
|
|
//! memoize expensive computations on top of the same checksummed,
|
|
//! persist-on-disk artifact store. Two API styles are provided:
|
|
//!
|
|
//! * **Manual** — [`Memoize::get_or_compute_with_key`] with an explicit
|
|
//! string key, or [`Memoize::get_or_compute`] with auto-derived keys
|
|
//! via the [`MemoKey`] trait.
|
|
//! * **Declarative** — the `session_memoize!` macro wraps a function so
|
|
//! that recursive calls transparently consult the cache, similar to
|
|
//! `kash`/`cached`.
|
|
|
|
mod memoize;
|
|
mod session;
|
|
|
|
pub use memoize::{MemoKey, Memoize, MemoizeValue};
|
|
pub use session::{ParamsConflict, Session, SessionOutcome};
|