Skip to content
lambda-symbolicsPublic

About

FFF bindings for Common Lisp

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clifff

clifff is a Common Lisp binding for the C interface of fff. It provides an in-process indexed search engine and an optional supervised helper process for applications that need native crashes isolated from their main Lisp image.

The current binding covers fuzzy file search, glob search, literal, regular expression and fuzzy content search, and multi-pattern content search.

Loading

(asdf:load-system :clifff)

(defparameter *engine*
  (clifff:make-engine
   :library-path #P"/path/to/libfff_c.so"
   :base-path #P"/path/to/workspace/"
   :cache-directory #P"/path/to/private-cache/"))

The caller supplies the compiled fff C library, version 0.11.0 or newer. clifff does not install a binary, modify PATH, or select a particular fff revision. Content searches enforce their time budget even when nothing matches, and the page’s next file offset resumes at the first unsearched file. A file with more matches than the per-file limit is listed in :truncated-paths, and the rendered page names it.

Searches return readable property lists. Presentation helpers are provided for compact terminal or model output.

(clifff:render-file-result
 (clifff:engine-search-files *engine* "provider" :page-size 20))

Always close an engine when it is no longer needed:

(clifff:engine-close *engine*)

Pinned library location

A host that builds fff’s C library from a pinned commit records the commit with FFF-LIBRARY-WRITE-MANIFEST beside the library. FFF-LIBRARY-LOCATE then returns the library in an install directory only when its manifest records the expected commit, signaling CLIFFF-ERROR otherwise; an :override library, such as one from a package manager, is trusted as given. FFF-LIBRARY-FILE-NAME is the platform’s library file name.

Supervised worker

make-worker accepts a command that loads clifff and calls worker-main. The parent restarts a dead helper once and resets its private fff databases before retrying. This process boundary protects the parent from accidental native failures. It is not a security sandbox.

The request supplies its workspace, cache, fff library and diagnostic log paths. Changing the log destination restarts the helper so distinct application configurations do not share diagnostics accidentally.

worker-file-count asks the helper how many indexed files match a glob, so a host can check that a path filter names existing files before searching under it.

Tests

(asdf:test-system :clifff)

Set CLIFFF_LIBRARY to exercise the native integration tests.

Part of the Lambda Symbolics library shelf.

About

FFF bindings for Common Lisp

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages