IFilesystem implementation backed by babashka.fs + java.nio. All operations return hive-dsl Results for railway composition.
Convenience API (stateless, default instance): (mkdirs! path) → Result<{:path}> (tmpdir! prefix) → Result<{:path}> (atomic-write! path content) → Result<{:path :bytes}> (lock! path timeout-ms) → Result<{:lock}> (watch! path patterns handler) → Result<{:watcher}>
DIP: consumers depend on the IFilesystem protocol, not this impl. Swap FsFilesystem for a test double via make-filesystem or the protocol.
IFilesystem implementation backed by babashka.fs + java.nio.
All operations return hive-dsl Results for railway composition.
Convenience API (stateless, default instance):
(mkdirs! path) → Result<{:path}>
(tmpdir! prefix) → Result<{:path}>
(atomic-write! path content) → Result<{:path :bytes}>
(lock! path timeout-ms) → Result<{:lock}>
(watch! path patterns handler) → Result<{:watcher}>
DIP: consumers depend on the IFilesystem protocol, not this impl.
Swap FsFilesystem for a test double via make-filesystem or the protocol.(atomic-write! path content)(atomic-write! path content opts)Write content to path via a sibling temp file + atomic rename, so a reader
never observes a partial file. Returns Result<{:path :bytes}>.
Write `content` to `path` via a sibling temp file + atomic rename, so a reader
never observes a partial file. Returns Result<{:path :bytes}>.(lock! path timeout-ms)Acquire an exclusive advisory lock, polling until timeout-ms.
Returns Result<{:lock {:path :release :handle}}>.
Acquire an exclusive advisory lock, polling until `timeout-ms`.
Returns Result<{:lock {:path :release :handle}}>.(make-filesystem)Create an FsFilesystem instance. For DI injection or test doubles.
Create an FsFilesystem instance. For DI injection or test doubles.
(mkdirs! path)Create path and missing parents; idempotent. Returns Result<{:path}>.
Create `path` and missing parents; idempotent. Returns Result<{:path}>.
(tmpdir!)(tmpdir! prefix)Create a temporary directory. Returns Result<{:path}>.
Create a temporary directory. Returns Result<{:path}>.
(watch! path patterns handler)Watch path for create/modify/delete of children matching patterns (globs;
empty = all), calling handler with {:kind :path}.
Returns Result<{:watcher {:path :stop}}>.
Watch `path` for create/modify/delete of children matching `patterns` (globs;
empty = all), calling `handler` with {:kind :path}.
Returns Result<{:watcher {:path :stop}}>.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 |