Back
Channel (clj)
(source)protocol
Examples
puppetlabs/trapperkeeper
(ns puppetlabs.trapperkeeper.app
(:require [schema.core :as schema]
[puppetlabs.trapperkeeper.services :as s]
[clojure.core.async.impl.protocols :as async-prot])
(:import (clojure.lang IDeref)))
(def TrapperkeeperAppContext
"Schema for a Trapperkeeper application's internal context. NOTE: this schema
is intended for internal use by TK and may be subject to minor changes in future
releases."
{:service-contexts {schema/Keyword {schema/Any schema/Any}}
:ordered-services TrapperkeeperAppOrderedServices
:services-by-id {schema/Keyword (schema/protocol s/Service)}
:lifecycle-channel (schema/protocol async-prot/Channel)
:shutdown-channel (schema/protocol async-prot/Channel)
:lifecycle-worker (schema/protocol async-prot/Channel)
:shutdown-reason-promise IDeref})
typedclojure/typedclojure
End users should use typed.lib.clojure.core.async, which all types here
are qualified under."}
typed.ann.clojure.core.async
(:require [typed.clojure :refer [ann ann-datatype defalias ann-protocol] :as t]
[typed.lib.clojure.core.async :as-alias ta]
[clojure.core.async.impl.protocols :as-alias impl])
(:import (java.util.concurrent.locks Lock)))
;TODO how do we encode that nil is illegal to provide to Ports/Channels?
; Is it essential?
(ann-protocol clojure.core.async.impl.protocols/Channel
close! [impl/Channel -> nil])
(ann-datatype [[w :variance :contravariant]
[r :variance :covariant]]
clojure.core.async.impl.channels.ManyToManyChannel
[]
:unchecked-ancestors [impl/Channel
(impl/ReadPort r)
(impl/WritePort w)])
(defalias
^{:forms '[(Chan2 t t)]}
ta/Chan2
"A core.async channel that can take type w and put type r"
(t/TFn [[w :variance :contravariant]
[r :variance :covariant]]
(t/I (ta/Port2 w r)
impl/Channel)))
(ann ^:no-check clojure.core.async/close! [impl/Channel :-> nil])
polygloton/pipeline
(ns ^{:doc "Custom schemas"}
pipeline.utils.schema
(:require [schema.core :as schema])
(:import clojure.core.async.impl.protocols.Channel))
(def Chan Channel)