claro.engine
Main resolution and engine logic.
Claro’s resolution engine is powerful and customizable, allowing for flexible introspection and manipulation of every resolution run.
See the Engine documentation for details and examples.
engine
(engine)
(engine opts)
(engine impl opts)
Create a new resolution engine, based on the following options:
:env
: a value that is passed as theenv
parameter toResolvable
s’resolve!
andresolve-batch!
functions (default:{}
),:adapter
: a function that will be called to run calls toresolve!
andresolve-batch!
,:selector
: aclaro.engine.selector/Selector
implementation used during each iteration to decide what to resolve next,:max-cost
: a value describing the maximum resolution cost for each run, causing the engine to throw anIllegalStateException
(default:32
) if exceeded,check-cost?
: a flag enabling/disabling cost protection (default:true
).
The resulting value’s resolution behaviour can be wrapped using claro.engine/wrap
.
multi-engine
(multi-engine)
(multi-engine base-engine)
Create a resolution engine that takes a seq of values and resolves them in-order and independently using the optionally given base engine.
This is especially useful when resolving multiple mutations since the cache will be reset between runs.
run!
(run! value)
(run! opts value)
Resolve the given value using an engine created on-the-fly. See claro.engine/engine
for available options. Immediately returns a deferred.
run!!
(run!! value)
(run!! opts value)
Resolve the given value using an engine created on-the-fly. See claro.engine/engine
for available options. Blocks until the resolved value has been obtained.
wrap
(wrap engine wrap-fn)
Wrap the engine’s complete resolver function using the given wrap-fn
. The resolution results will be wrapped as trees. See wrap-transform and wrap-pre-transform for access to the transformed and raw results.
wrap-pre-transform
added in 0.2.8
(wrap-pre-transform engine wrap-fn)
Wrap the given engine’s resolver (before transformation) using the given wrap-fn
.
wrap-transform
added in 0.2.8
(wrap-transform engine wrap-fn)
Wrap the given engine’s resolver (after transformation but before tree wrapping) using the given wrap-fn
.