From e0dddff176a01d410904b6750b3395de4f7e54db Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 21:39:00 +0200 Subject: plan 9: keyword cache keys on extension, max-read and Unicode tables, trims removed keywords --- docs/design.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'docs/design.md') diff --git a/docs/design.md b/docs/design.md index caa2a0f..bea0e2f 100644 --- a/docs/design.md +++ b/docs/design.md @@ -336,9 +336,11 @@ Extraction is nearly all of a run's time, so krino remembers what it found. For each file it extracted, `.cache` records which of the directory's content keywords the text contains, against the full list of keywords it was checked against. It stores no text and no file names; a -file is known by device, inode, size and modification time, which krino's -own moves and renames keep. The keywords themselves are stored, as they -appear in the config. +file is known by device, inode, size, modification time and extension +(the extension picks the extractor), which a move within one filesystem +keeps. The keywords themselves are stored, normalised the way the test +compares them (case, folding, whitespace), and only those the directory +still uses. - When a file is extracted, every content keyword of its directory is answered at once, so one extraction serves every rule and exclude. @@ -347,16 +349,20 @@ appear in the config. replaced: a changed file, or a new keyword, costs one extraction. - Files above `max-read` are refused before the cache is consulted. Failures (unreadable, tool missing, timeout) are never cached. -- The cache is discarded whole when the extractor fingerprint changes: a - tool installed, removed or replaced, or krino's extraction code changing - (`extract.Version`), or its text normalisation changing (`norm.Version`). +- The cache is discarded whole when its fingerprint changes: a tool + installed, removed or replaced; krino's extraction code (`extract.Version`) + or normalisation (`norm.Version`) changing; the Go release or the Unicode + tables changing; or the directory's `max-read` changing. - Planning a run (`-n` included) reads the cache and writes it back holding only files still in the directory, under the directory's lock, via a - temporary file renamed into place; the directory is 0700, the file 0600. - `explain` reads it and never writes. A directory with no content tests - has no cache. -- Known gap: a file edited in place with its size and modification time - deliberately preserved keeps its old answers. Deleting + temporary file renamed into place; the directory is made 0700, the file + 0600. `explain` reads it and never writes. A directory with no content + tests has no cache, and an old one is removed. +- Known gaps: a file edited in place with its size and modification time + deliberately preserved keeps its old answers, and so does a new file that + reuses a deleted file's inode with the same size, extension and preserved + modification time. A `.doc` that `antiword` failed on (a timeout, say) and + `catdoc` then read is cached with `catdoc`'s answers. Deleting `~/.cache/krino` resets everything. ## 7. Actions -- cgit v1.3