0.1.2 docs





    Feb 25, 2016

    Patrick Monteith


    Index of all namespaces

    « Project + dependencies

    A simple, flexible helper for building modular systems with clojure/core.async

    Buffer creation. Defines the multimethod create-buffer that accepts a tuple [type size]
    which can be added to with defmethod for custom buffer types. For ease of use, calling
    create-buffer with just a size will create a fixed size buffer of that size.
    Helper functions for creating pipe functions.
    A pipe function is a function of the form: (fn [in-ch out-ch]
    where the shutdown-callback is an optional 0-arg function that will
    be called when shutting down. If the connections made in the pipe function
    will be naturally closed when the in-ch closes, this is unnecessary.
    The purpose is to provide a flexible way of defining how to connect modules and
    these helpers allow you to perform simple connections without needing to worry about
    the details of core.async
    The README below is fetched from the published project artifact. Some relative links may be broken.


    A simple, flexible helper for building modular systems with clojure/core.async


    Clojars Project

    Declare modules of the form:

    {:ins #{topics} :outs #{topics} :pipe pipe-fn-creator}

    Connect together your system design:

    (asystant.core/add-modules asystant.core/new-system modules)

    Build your system:

    (! system initialisation-params)

    The pipe function creator takes a map of initialisation parameters and returns a pipe function.

    (defn my-pipe-fn-creator [{:keys [bar]}]
      (fn [in-ch out-ch]
        (foo bar in-ch out-ch)))

    A pipe function is a function that takes an input channel and an output channel. This will be called on each module when you call build! and should be used to connect your functionality to the rest of the system.

    (defn my-pipe-fn [in-ch out-ch]
      (clojure.core.async/go-loop []
        (println (clojure.core.async/<! in-ch))

    Pipe utilities are available for the most common uses (source, sink, transform), allowing most modules to avoid directly using core.async at all. The previous example could be rewritten:

    (asystant.pipe/sink (fn [x] (println x)))

    There is currently some basic system visualisation functionality (using loom and graphviz) which will be built on, allowing easy debugging of the system making it simple to identify problems


    Copyright © 2015 Patrick Monteith

    Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.