THE canonical way vis talks to fff.
Every fff instance in this process is born here and lives in ONE pool keyed
by [canonical-root respect-ignore-files? ignore-overlay]. Nothing else may call
fff/create — a second, unpooled instance would duplicate a whole tree's
native path+content index, spin its own watcher threads, and go stale on our
own writes.
Contract for callers:
(fff-index/with-index [idx (fff-index/lease root respect-ignore-files? overlay)] (fff/search idx …) (fff/grep idx …))
:watch? true) and resynced before the body
runs when this process wrote inside its tree since it was last synced,idx; borrowed indexes cannot be evicted,note-fs-write! with the changed path so the
next search reads its own writes without rescanning unrelated drafts.THE canonical way vis talks to fff.
Every fff instance in this process is born here and lives in ONE pool keyed
by `[canonical-root respect-ignore-files? ignore-overlay]`. Nothing else may call
`fff/create` — a second, unpooled instance would duplicate a whole tree's
native path+content index, spin its own watcher threads, and go stale on our
own writes.
Contract for callers:
(fff-index/with-index [idx (fff-index/lease root respect-ignore-files? overlay)]
(fff/search idx …) (fff/grep idx …))
- the index is watcher-live (`:watch? true`) and resynced before the body
runs when this process wrote inside its tree since it was last synced,
- all gateway workers share the pool and the same root/policy index,
- the body must NOT close `idx`; borrowed indexes cannot be evicted,
- filesystem mutations call `note-fs-write!` with the changed path so the
next search reads its own writes without rescanning unrelated drafts.(lease root respect-ignore-files?)(lease root respect-ignore-files? overlay)One pool key: which root, under which ignore policy, with which ignore
overlay. Bundled into a single value so with-index keeps a plain
[binding init] shape.
One pool key: which root, under which ignore policy, with which ignore overlay. Bundled into a single value so `with-index` keeps a plain `[binding init]` shape.
Largest file whose CONTENT the pooled index will read, in bytes (256 MiB).
fff's own default is 10 MB (MAX_FFFILE_SIZE), and everything above it was
skipped SILENTLY: a needle sitting in a 20 MB log, dump or generated source
made grep answer "No file NAME or CONTENT matched". A silent false
negative is strictly worse than the slow scan this discovery path replaced,
so the budget is raised HERE and at the fff/grep call site — the index's
own content budget wins, so moving only one of the two still reads nothing.
Cost is page cache, not heap: fff reads these files itself, and vis streams
them line by line (search-file-content) rather than slurping them.
Largest file whose CONTENT the pooled index will read, in bytes (256 MiB). fff's own default is 10 MB (`MAX_FFFILE_SIZE`), and everything above it was skipped SILENTLY: a needle sitting in a 20 MB log, dump or generated source made `grep` answer "No file NAME or CONTENT matched". A silent false negative is strictly worse than the slow scan this discovery path replaced, so the budget is raised HERE and at the `fff/grep` call site — the index's own content budget wins, so moving only one of the two still reads nothing. Cost is page cache, not heap: fff reads these files itself, and vis streams them line by line (`search-file-content`) rather than slurping them.
(note-fs-write! path)Invalidate pooled trees overlapping the changed path's directory. Taking the parent also covers ancestor ignore-file changes and directory replacement. Unrelated draft roots keep their read-your-writes epoch and do not rescan.
Invalidate pooled trees overlapping the changed path's directory. Taking the parent also covers ancestor ignore-file changes and directory replacement. Unrelated draft roots keep their read-your-writes epoch and do not rescan.
(pool-stats)Process-wide lifecycle totals and current leases, without forcing a cold index.
Counters distinguish initial scans, reuse, invalidation and eviction reasons;
structured ::lifecycle logs carry per-root scan duration and index identity.
Process-wide lifecycle totals and current leases, without forcing a cold index. Counters distinguish initial scans, reuse, invalidation and eviction reasons; structured `::lifecycle` logs carry per-root scan duration and index identity.
(prewarm! lease)Build this lease's index OFF the calling thread, at most one build in flight
per key (the pool's delay guarantees that). Returns nil immediately; poll
warm? to find out when searching became cheap.
Build this lease's index OFF the calling thread, at most one build in flight per key (the pool's `delay` guarantees that). Returns nil immediately; poll `warm?` to find out when searching became cheap.
(warm? lease)True when this lease's index is ALREADY built — i.e. with-index on it will
only pay for a search, never for a tree scan. Lets a latency-sensitive caller
(the TUI @ popup on the render thread) skip the first, blocking build.
True when this lease's index is ALREADY built — i.e. `with-index` on it will only pay for a search, never for a tree scan. Lets a latency-sensitive caller (the TUI `@` popup on the render thread) skip the first, blocking build.
(with-index [sym lease] & body)(with-index [idx (lease root respect?)] body…) — body runs with a
POOLED, watcher-live fff index, resynced before use. Do NOT close idx: the
pool owns it and retires it on idle/LRU eviction.
`(with-index [idx (lease root respect?)] body…)` — body runs with a POOLED, watcher-live fff index, resynced before use. Do NOT close `idx`: the pool owns it and retires it on idle/LRU eviction.
(with-index* lease f)Call f with the process-wide index shared by every worker for this root and
ignore policy. Borrowed indexes remain in the pool under capacity pressure.
Failed builds are removed so a later call can retry.
Call `f` with the process-wide index shared by every worker for this root and ignore policy. Borrowed indexes remain in the pool under capacity pressure. Failed builds are removed so a later call can retry.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |