Event emission for hive-hot integration with hive-events.
Event schemas:
Events are dispatched via hive.events/dispatch for system-wide observability and coordination.
Event emission for hive-hot integration with hive-events.
Event schemas:
- [:file/changed {:file "src/foo.clj" :type :modify|:create|:delete}]
- [:hot/reload-start {}]
- [:hot/reload-success {:loaded [ns...] :unloaded [ns...] :ms N}]
- [:hot/reload-error {:failed ns :error "message"}]
Events are dispatched via hive.events/dispatch for system-wide
observability and coordination.(emit! [event-type data])Emit an event via hive-events dispatch.
Automatically adds :timestamp to event data.
Example:
(emit! [:hot/reload-start {}])
Emit an event via hive-events dispatch.
Automatically adds :timestamp to event data.
Example:
```clojure
(emit! [:hot/reload-start {}])
```(emit-file-changed! file change-type)Emit a :file/changed event.
Args:
Example:
(emit-file-changed! "src/my/ns.clj" :modify)
Emit a :file/changed event. Args: - file: Path to the changed file (string) - change-type: One of :modify, :create, :delete Example: ```clojure (emit-file-changed! "src/my/ns.clj" :modify) ```
(emit-reload-error! failed-ns error)Emit a :hot/reload-error event.
Args:
Example:
(emit-reload-error! 'my.broken.ns "Syntax error on line 42")
Emit a :hot/reload-error event. Args: - failed-ns: The namespace symbol that failed to load - error: Error message or exception Example: ```clojure (emit-reload-error! 'my.broken.ns "Syntax error on line 42") ```
(emit-reload-start!)Emit a :hot/reload-start event.
Called at the beginning of a reload operation.
Emit a :hot/reload-start event. Called at the beginning of a reload operation.
(emit-reload-success! loaded unloaded ms)Emit a :hot/reload-success event.
Args:
Example:
(emit-reload-success! ['my.ns 'my.other] ['my.ns] 42)
Emit a :hot/reload-success event. Args: - loaded: Sequence of namespace symbols that were loaded - unloaded: Sequence of namespace symbols that were unloaded - ms: Elapsed time in milliseconds Example: ```clojure (emit-reload-success! ['my.ns 'my.other] ['my.ns] 42) ```
(make-claim-checker query-fn)Create a claim-checker function that queries the logic module.
The returned function takes no arguments and returns a set of currently claimed file paths.
Args:
Example:
;; In hive-mcp, inject the actual query function:
(def claim-checker
(make-claim-checker logic/get-all-claims))
;; The debouncer uses it like:
(let [claimed-files (claim-checker)]
(if (contains? claimed-files "src/foo.clj")
:buffer
:proceed))
Create a claim-checker function that queries the logic module.
The returned function takes no arguments and returns a set of
currently claimed file paths.
Args:
- query-fn: A function that returns a sequence of claim maps
with :file keys (e.g., hive-mcp's logic/get-all-claims)
Example:
```clojure
;; In hive-mcp, inject the actual query function:
(def claim-checker
(make-claim-checker logic/get-all-claims))
;; The debouncer uses it like:
(let [claimed-files (claim-checker)]
(if (contains? claimed-files "src/foo.clj")
:buffer
:proceed))
```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 |