Liking cljdoc? Tell your friends :D

exoscale.interceptor


after-stageclj/s

(after-stage f after-f)

Modifies context after stage function ran

Modifies context after stage function ran
sourceraw docstring

before-stageclj/s

(before-stage f before-f)

Wraps stage fn with another one, basically a middleware that will be run before a stage

Wraps stage fn with another one, basically a middleware that will be run before
a stage
sourceraw docstring

discardclj/s

(discard f)

Run function for side-effects only and return context

Run function for side-effects only and return context
sourceraw docstring

enqueueclj/s

(enqueue ctx interceptors)

Adds interceptors to current context

Adds interceptors to current context
sourceraw docstring

errorclj/s

(error ctx error)

Adds error to context, potentially triggering :error stage on current/next interceptor

Adds error to context, potentially triggering `:error` stage on
current/next interceptor
sourceraw docstring

executeclj/s

(execute ctx)
(execute ctx interceptors)

Executes a queue of Interceptors attached to the context. Context must be a map. Interceptors are added with exoscale.interceptor/enqueue.

An Interceptor is a map or map-like object with the keys :enter, :leave, and :error. The value of each key is a function; missing keys or nil values are ignored. When executing a context, first all the :enter functions are invoked in order. As this happens, the Interceptors are pushed onto a stack.

When execution reaches the end of the queue, it begins popping Interceptors off the stack and calling their :leave functions. Therefore :leave functions are called in the opposite order from :enter functions.

Both the :enter and :leave functions are called on a single argument, the context map, and return an updated context.

If any Interceptor function throws an exception, execution stops and begins popping Interceptors off the stack and calling their :error functions. The :error function takes two arguments: the context and the error triggering the call. If you rethrow the error or assoc it into the context under :exoscale.interceptor/error (or via the exoscale.inceptor/error fn) other :error handlers will be triggered from the stack, if you just return the context it will resume triggering :leave functions.

If the :error reaches the end of the stack without being handled, execute will throw it.

Executes a queue of Interceptors attached to the context. Context
must be a map. Interceptors are added with
`exoscale.interceptor/enqueue`.

An Interceptor is a map or map-like object with the keys `:enter`,
`:leave`, and `:error`. The value of each key is a function; missing
keys or nil values are ignored. When executing a context, first all
the `:enter` functions are invoked in order. As this happens, the
Interceptors are pushed onto a stack.

When execution reaches the end of the queue, it begins popping
Interceptors off the stack and calling their `:leave` functions.
Therefore `:leave` functions are called in the opposite order from
`:enter` functions.

Both the `:enter` and :leave functions are called on a single
argument, the context map, and return an updated context.

If any Interceptor function throws an exception, execution stops and
begins popping Interceptors off the stack and calling their `:error`
functions. The `:error` function takes two arguments: the context
and the error triggering the call. If you rethrow the error or assoc
it into the context under `:exoscale.interceptor/error` (or via the
`exoscale.inceptor/error` fn) other :error handlers will be
triggered from the stack, if you just return the context it will
resume triggering `:leave` functions.

If the `:error` reaches the end of the stack without being handled,
execute will throw it.
sourceraw docstring

haltclj/s

(halt ctx)

Removes all remaining interceptors from context's execution queue and stack. This effectively short-circuits execution of Interceptors' :enter/:leave and returns the context

Removes all remaining interceptors from context's execution queue and stack.
This effectively short-circuits execution of
Interceptors' `:enter`/`:leave` and returns the context
sourceraw docstring

inclj/s

(in f path)

Modifies interceptor stage to take in specified path

Modifies interceptor stage to *take in* specified path
sourceraw docstring

into-stagesclj/s

(into-stages chain stages f)

Applies fn f on all stages (collection of :enter, :leave and/or :error) of chain. This provides a way to apply middlewares to an entire interceptor chain at definition time.

Useful when used in conjunction with, after-stage, before-stage.

f will be a function of a stage function, such as the ones returned by before-stage, after-stage and an execution context. The stage function is a normal interceptor stage function, taking 1 or 2 args depending on stage of execution (enter/leave or error, error taking 2 args), can potentially be multi-arg if it has to be used for all stage types. The execution context is a map that will contain an :interceptor key with the value for the current interceptor and :stage to indicate which stage we're at (enter, leave or error).

`(into-stages [...] [:enter :error] (fn [stage-f execution-ctx] (after-stage stage-f (fn [...] ...))))

Applies fn `f` on all `stages` (collection of :enter, :leave and/or :error) of
`chain`. This provides a way to apply middlewares to an entire interceptor
chain at definition time.

Useful when used in conjunction with, `after-stage`, `before-stage`.

`f` will be a function of a `stage` function, such as the ones returned by
`before-stage`, `after-stage` and an `execution context`. The stage function
is a normal interceptor stage function, taking 1 or 2 args depending on stage
of execution (enter/leave or error, error taking 2 args), can potentially be
multi-arg if it has to be used for all stage types. The execution context is a
map that will contain an `:interceptor` key with the value for the current
interceptor and `:stage` to indicate which stage we're at (enter, leave or
error).

`(into-stages [...] [:enter :error] (fn [stage-f execution-ctx] (after-stage stage-f (fn [...] ...))))
sourceraw docstring

lensclj/s

(lens f path)

Modifies interceptor stage to take from path and return to path

Modifies interceptor stage to take from path and return to path
sourceraw docstring

outclj/s

(out f path)

Modifies interceptor stage to return at specified path

Modifies interceptor stage to *return at* specified path
sourceraw docstring

removeclj/s

(remove ctx pred)

Remove all interceptors matching predicate from stack/queue, returns context

Remove all interceptors matching predicate from stack/queue, returns context
sourceraw docstring

terminateclj/s

(terminate ctx)

Removes all remaining interceptors from context's execution queue. This effectively short-circuits execution of Interceptors' :enter functions and begins executing the :leave functions.

Removes all remaining interceptors from context's execution queue.
This effectively short-circuits execution of Interceptors' `:enter`
functions and begins executing the `:leave` functions.
sourceraw docstring

transformclj/s

(transform f f')

Takes stage function, and wraps it with callback that will return a new context from the application of f' onto it. It can be useful to run a separate function after a stage returns and apply some transformation to it relative to the original context. f' takes the initial stage context and f realized return value as arguments.

Takes stage function, and wraps it with callback that will return a
new context from the application of `f'` onto it. It can be useful
to run a separate function after a stage returns and apply some
transformation to it relative to the original context. `f'` takes
the *initial* stage context and `f` realized return value as
arguments.
sourceraw docstring

whenclj/s

(when f pred)

Modifies interceptor stage to only run on ctx if pred returns true'ish

Modifies interceptor stage to only run on ctx if pred returns true'ish
sourceraw docstring

xformclj/s

(xform ctx xf)

Takes a context from execution and run xf (transducing fn) on stack/queue, returns a new context

Takes a context from execution and run xf (transducing fn) on stack/queue,
returns a new context 
sourceraw docstring

xform-queueclj/s

(xform-queue ctx xf)

Takes a context from execution and run xf (transducing fn) on queue, returns a new context

Takes a context from execution and run xf (transducing fn) on queue, returns a
new context 
sourceraw docstring

xform-stackclj/s

(xform-stack ctx xf)

Takes a context from execution and run xf (transducing fn) on stack, returns a new context

Takes a context from execution and run xf (transducing fn) on stack, returns a
new context 
sourceraw docstring

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

× close