Liking cljdoc? Tell your friends :D

hive-system.fs.filesystem

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.
raw docstring

atomic-write!clj

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

lock!clj

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

make-filesystemclj

(make-filesystem)

Create an FsFilesystem instance. For DI injection or test doubles.

Create an FsFilesystem instance. For DI injection or test doubles.
sourceraw docstring

mkdirs!clj

(mkdirs! path)

Create path and missing parents; idempotent. Returns Result<{:path}>.

Create `path` and missing parents; idempotent. Returns Result<{:path}>.
sourceraw docstring

tmpdir!clj

(tmpdir!)
(tmpdir! prefix)

Create a temporary directory. Returns Result<{:path}>.

Create a temporary directory. Returns Result<{:path}>.
sourceraw docstring

watch!clj

(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}}>.
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