Expand description
Per-take diagnostics written to disk, best-effort.
One take becomes one directory holding the original capture, every transcription stage, and the timings - so βwhich stage ate the wordsβ is answerable by opening files rather than by rerunning the take under investigation. The layout is granular on purpose: the pre-normalization text is kept per window, because the joined form cannot show whether a window lost the words or the join did.
Everything here is best-effort: a capture that cannot be written is logged and dropped, never propagated, because diagnostics must never break a take.
Retention: the store keeps the last RETAINED_TAKES takes,
pruning the oldest by directory name after each write.
Re-exportsΒ§
use std::path::Path;πuse std::path::PathBuf;πuse std::time::SystemTime;πuse std::time::UNIX_EPOCH;πuse serde_json::json;πuse transcribe_cpp::CancelToken;πuse crate::audio::SAMPLE_RATE;πuse crate::config::ModelSpec;πuse crate::engine::Stages;π
StructsΒ§
- Take
Models π - The models a take ran under: the resolved specs the engine was built with.
- Take
Record π - Everything one finished take contributes to the store.
- Window
Record π - One windowβs record: the slice of capture it covered and the raw pre-normalization text it produced.
ConstantsΒ§
- RETAINED_
TAKES π - How many takes the store keeps, and the benchβs corpus along with it.
FunctionsΒ§
- capture_
take π - Write one take into
dir/take-<take_id>/and prune the store toRETAINED_TAKES. Nothing here can fail the caller: every step logs its own failure and stops that takeβs capture. - claim_
take_ πdir - Claim
dir/take-<stamp>/, advancing a millisecond per name already taken, and answer the name and the directory it claimed. - model_
identity π - One roleβs resolved spec as
meta.jsonnames it: the file, the digest it declares where it declares one, and the size. - prune π
- Delete every take but the newest
RETAINED_TAKES. Only store directories count -take-followed by nothing but digits - so a user directory that happens to share the prefix is never touched. Removal is best-effort, and a directory that will not leave is logged: it occupies a retention slot invisibly otherwise. - sha256_
file π - A fileβs sha256, lowercase hex; empty when it cannot be read.
- starts_
take π - A store directory:
take-followed by all-ASCII digits. Anything else -take-2026-photos, a userβs own folder - is not ours to prune. - take_
stamp π - The unix-millisecond stamp a take directory is named by, as
take-<13 digits>: sortable, and 13 digits holds until the year 2286 so lexicographic order never lies about recency. - write_
take π - One claimed takeβs files,
meta.jsonlast, answering whether the take was written whole. - write_
wav π - Encode
audioas a canonical 16-bit PCM wav at the one rate every model here reads.