Liking cljdoc? Tell your friends :D

rift-clojure

Clojars Project CI

Clojure binding to rift — copy-on-write development workspaces, a faster alternative to git worktree (instant, near-zero disk via APFS clonefile on macOS / btrfs snapshots on Linux).

It loads rift's native librift_ffi in-process through the JDK Foreign Function & Memory API (java.lang.foreign) — no subprocess, no JNI. Same shared library rift ships for Bun/Node, called from the JVM.

⚠️ rift is experimental. This is a vendored binding: its version tracks the rift release 1:1 — com.blockether/rift X.Y.Z bundles rift vX.Y.Z.

Install

com.blockether/rift {:mvn/version "0.0.8"}

Run the JVM with native access enabled (else the linker refuses to load the lib):

--enable-native-access=ALL-UNNAMED

Usage

(require '[com.blockether.rift :as rift])

(rift/init   {:at "/repo"})                         ; register a rift root
(def ws (rift/create {:from "/repo" :name "fix"}))  ; => CoW copy path
(rift/list      {:of "/repo"})                      ; => direct children
(rift/ancestors {:of ws})                           ; => parents, nearest first
(rift/remove!   {:at ws})                            ; trash it
(rift/gc)                                            ; delete trashed storage

Every fn takes an optional :database (rift's SQLite registry). Set a default once instead of repeating it:

(rift/set-default-database! "/path/to/rift.sqlite")  ; process-wide
(rift/with-database "/tmp/test.sqlite" …)            ; scoped

Precedence: explicit :database > with-database > set-default-database! > platform default ((rift/default-database)).

Errors are ex-info with {:type :rift/error :code <string> :path <string?>} (cow_unavailable, workspace_not_initialized, already_exists, …).

Platforms

PlatformLibraryBackend
darwin-arm64librift_ffi.dylibAPFS clonefile
linux-x64librift_ffi.sobtrfs snapshots
linux-arm64librift_ffi.sobtrfs snapshots

Linux CoW requires a btrfs filesystem.

Native libraries

Built from rift's crates/ffi at the release tag, on native GitHub runners, and bundled into the published jar — never committed. deploy.yml builds every platform on each v* tag and publishes to Clojars; ci.yml builds + tests each platform on push/PR. Locally, scripts/build-natives.sh populates the git-ignored resources/prebuilds/.

Develop

clojure -X:test          # run the test suite
clojure -T:build jar     # build the jar
clojure -T:build install # install to ~/.m2

License

MIT (matching rift); vendored librift_ffi binaries © the rift authors, MIT.

Can you improve this documentation?Edit on GitHub

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