Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.fff-index

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 anything since it was last synced,
  • the body must NOT close idx; the pool owns it (LRU + idle TTL),
  • every filesystem mutation this process performs must call note-fs-write! so the next search reads its own writes.
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 anything since it was last synced,
- the body must NOT close `idx`; the pool owns it (LRU + idle TTL),
- every filesystem mutation this process performs must call `note-fs-write!`
  so the next search reads its own writes.
raw docstring

leaseclj

(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.
sourceraw docstring

note-fs-write!clj

(note-fs-write!)

Tell the fff index pool that THIS process just mutated the filesystem. Cheap (one atomic increment); call it from every write/copy/move/delete path so the next search sees your write.

Tell the fff index pool that THIS process just mutated the filesystem. Cheap
(one atomic increment); call it from every write/copy/move/delete path so the
next search sees your write.
sourceraw docstring

prewarm!clj

(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.
sourceraw docstring

warm?clj

(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.
sourceraw docstring

with-indexcljmacro

(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.
sourceraw docstring

with-index*clj

(with-index* lease f)

Call f with a POOLED fff index for lease's root + ignore policy. The entry is leased for the call, so a concurrent eviction defers its close to the last lease holder instead of yanking a live index. A build that THROWS is removed from the pool (a poisoned slot would fail every later search).

Call `f` with a POOLED fff index for `lease`'s root + ignore policy. The entry
is leased for the call, so a concurrent eviction defers its close to the last
lease holder instead of yanking a live index. A build that THROWS is removed
from the pool (a poisoned slot would fail every later search).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close