Liking cljdoc? Tell your friends :D
Clojure only.

manifold.lifecycle

Convention based lifecycle management of asynchronous chains. This implements a lightweight take on the ideas behind interceptors and similar libraries.

Notable differences are:

  • Manifold is the sole provided execution model for chains
  • No chain manipulation can occur
  • Guards and finalizer for steps are optional
  • Exceptions during lifecycle steps stop the execution
Convention based lifecycle management of asynchronous chains.
This implements a lightweight take on the ideas behind interceptors
and similar libraries.

Notable differences are:

- Manifold is the sole provided execution model for chains
- No chain manipulation can occur
- Guards and finalizer for steps are optional
- Exceptions during lifecycle steps stop the execution
raw docstring

runclj

(run init steps)
(run init steps opts)

Run a series of potentially asynchronous steps in sequence on an initial value, threading each step's result to the next step.

Steps are maps or the following keys:

[:manifold.lifecycle/id keyword
 :manifold.lifecycle/handler
 :manifold.lifecycle/guard]
  • id is the unique ID for a step

  • handler is the function of the previous result

  • guard is an optional predicate of the current context and previous preventing execution of the step when yielding false Accepts an options map of the following keys:

    [:manifold.lifecycle/clock :manifold.lifecycle/raw-result?]

  • clock is an optional implementation of spootnik.clock/Clock, defaulting to the system's wall clock (spootnik.clock/wall-clock)

  • raw-result? toggles extraction of the result out of the context map, defaults to false

Run a series of potentially asynchronous steps in sequence
on an initial value, threading each step's result to the next step.

Steps are maps or the following keys:

    [:manifold.lifecycle/id keyword
     :manifold.lifecycle/handler
     :manifold.lifecycle/guard]

- `id` is the unique ID for a step
- `handler` is the function of the previous result
- `guard` is an optional predicate of the current context and previous
  preventing execution of the step when yielding false
Accepts an options map of the following keys:

    [:manifold.lifecycle/clock
     :manifold.lifecycle/raw-result?]

- `clock` is an optional implementation of `spootnik.clock/Clock`,
  defaulting to the system's wall clock (`spootnik.clock/wall-clock`)
- `raw-result?` toggles extraction of the result out of the context
  map, defaults to `false`
 
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close