Free from core.async
This commit is contained in:
parent
a99cac4285
commit
fb6e739aee
4 changed files with 8 additions and 12 deletions
|
|
@ -362,7 +362,8 @@ The callback `:success` is called with a map containing:
|
||||||
|
|
||||||
- `:value`: a return value from the pod var
|
- `:value`: a return value from the pod var
|
||||||
|
|
||||||
The callback `:error` is called with a map containing:
|
The callback `:error` is called in case the pod sends an error, a map
|
||||||
|
containing:
|
||||||
|
|
||||||
- `:ex-message`: an error message
|
- `:ex-message`: an error message
|
||||||
- `:ex-data`: an arbitrary additional error data map. Typically it will contain
|
- `:ex-data`: an arbitrary additional error data map. Typically it will contain
|
||||||
|
|
@ -371,9 +372,9 @@ The callback `:error` is called with a map containing:
|
||||||
If desired, `:ex-message` and `:ex-data` can be reified into a
|
If desired, `:ex-message` and `:ex-data` can be reified into a
|
||||||
`java.lang.Exception` using `ex-info`.
|
`java.lang.Exception` using `ex-info`.
|
||||||
|
|
||||||
The callback `:done` is called with one argument which is currently
|
The callback `:done` is called with one argument, a map. This callback can be
|
||||||
undefined. This callback can be used to determine if the pod is done sending
|
used to determine if the pod is done sending values, in case it wants to send
|
||||||
values.
|
multiple. The callback is only called if no errors were sent by the pod.
|
||||||
|
|
||||||
In the above example the wrapper function calls the pod identified by
|
In the above example the wrapper function calls the pod identified by
|
||||||
`"pod.babashka.filewatcher"`. It calls the var
|
`"pod.babashka.filewatcher"`. It calls the var
|
||||||
|
|
|
||||||
3
deps.edn
3
deps.edn
|
|
@ -1,6 +1,5 @@
|
||||||
{:deps {nrepl/bencode {:mvn/version "1.1.0"}
|
{:deps {nrepl/bencode {:mvn/version "1.1.0"}
|
||||||
cheshire {:mvn/version "5.10.0"}
|
cheshire {:mvn/version "5.10.0"}}
|
||||||
org.clojure/core.async {:mvn/version "1.1.587"}}
|
|
||||||
:aliases
|
:aliases
|
||||||
{:sci
|
{:sci
|
||||||
{:extra-deps
|
{:extra-deps
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
(:refer-clojure :exclude [read])
|
(:refer-clojure :exclude [read])
|
||||||
(:require [bencode.core :as bencode]
|
(:require [bencode.core :as bencode]
|
||||||
[cheshire.core :as cheshire]
|
[cheshire.core :as cheshire]
|
||||||
[clojure.core.async :as async]
|
|
||||||
[clojure.edn :as edn]))
|
[clojure.edn :as edn]))
|
||||||
|
|
||||||
(set! *warn-on-reflection* true)
|
(set! *warn-on-reflection* true)
|
||||||
|
|
@ -86,7 +85,7 @@
|
||||||
(and error? error-handler)
|
(and error? error-handler)
|
||||||
(error-handler {:ex-message ex-message
|
(error-handler {:ex-message ex-message
|
||||||
:ex-data ex-data})))
|
:ex-data ex-data})))
|
||||||
(when done?
|
(when (and done? (not error?))
|
||||||
(when promise?
|
(when promise?
|
||||||
(deliver chan nil))
|
(deliver chan nil))
|
||||||
(when done-handler
|
(when done-handler
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
(ns babashka.pods.sci-test
|
(ns babashka.pods.sci-test
|
||||||
(:require [babashka.pods.sci :as pods]
|
(:require [babashka.pods.sci :as pods]
|
||||||
[babashka.pods.test-common :refer [test-program assertions]]
|
[babashka.pods.test-common :refer [test-program assertions]]
|
||||||
[clojure.core.async :as async]
|
|
||||||
[clojure.test :refer [deftest]]
|
[clojure.test :refer [deftest]]
|
||||||
[sci.core :as sci]))
|
[sci.core :as sci]))
|
||||||
|
|
||||||
|
|
@ -14,7 +13,5 @@
|
||||||
test-program
|
test-program
|
||||||
{:namespaces {'babashka.pods
|
{:namespaces {'babashka.pods
|
||||||
{'load-pod pods/load-pod
|
{'load-pod pods/load-pod
|
||||||
'invoke pods/invoke}
|
'invoke pods/invoke}}}))]
|
||||||
'clojure.core.async
|
|
||||||
{'<!! async/<!!}}}))]
|
|
||||||
(assertions out err ret)))
|
(assertions out err ret)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue