Jobs allow you to define arbitrary and domain specific synchronous or asynchronous side effects of your application, separate from their implementation, and functions to execute and control them savely in your application.
Jobs allow you to define arbitrary and domain specific synchronous or asynchronous side effects of your application, separate from their implementation, and functions to execute and control them savely in your application.
(handle-jobs item options)
Returns an item that defines how jobs are
executed. Use [[run]] to get an action that can be emitted by
item
that adds a new job to an internal queue.
:execute
Required option: The item function to actually execute
the jobs. It is called with the job description and return an item
that must eventually emit an action with the result of the job.
:predicate
options: A predicate on the job descriptions. If it
returns false, the job is passed on upwards in the tree. Per default
all jobs must be handled by :execute
.
:transition
option: Jobs transition from a :pending state,
over :running into :completed, and for each transition (transition state job)
is evaluated on the returned item's state, which must
return a [[reacl-c.core/return]] value.
:manage
option:
Some control over the queue can be achieved by specifying manage
which is called on the queue after it changed and must return an
updated queue. You can remove jobs or change their order for example.
Newest items are at the end of the queue.
:parallelity
option: If nil
, the default, all jobs in the queue
are actually started immediately and 'in parallel'. Set to an
integer larger than 0 to specify that only that number of jobs are
executed at the same time.
Returns an item that defines how jobs are executed. Use [[run]] to get an action that can be emitted by `item` that adds a new job to an internal queue. `:execute` Required option: The item function to actually execute the jobs. It is called with the job description and return an item that must eventually emit an action with the result of the job. `:predicate` options: A predicate on the job descriptions. If it returns false, the job is passed on upwards in the tree. Per default all jobs must be handled by `:execute`. `:transition` option: Jobs transition from a :pending state, over :running into :completed, and for each transition `(transition state job)` is evaluated on the returned item's state, which must return a [[reacl-c.core/return]] value. `:manage` option: Some control over the queue can be achieved by specifying `manage` which is called on the queue after it changed and must return an updated queue. You can remove jobs or change their order for example. Newest items are at the end of the queue. `:parallelity` option: If `nil`, the default, all jobs in the queue are actually started immediately and 'in parallel'. Set to an integer larger than 0 to specify that only that number of jobs are executed at the same time.
(job-info job)
Returns the info object passed to [[run]].
Returns the info object passed to [[run]].
(job-result job)
Returns the result for this job, or nil if the status is not :completed
.
Returns the result for this job, or nil if the status is not `:completed`.
(job-status job)
Returns the status of this job, :pending
, :running
or :completed
.
Returns the status of this job, `:pending`, `:running` or `:completed`.
(job? value)
Returns whether the given value is a job.
Returns whether the given value is a job.
(start-job description & [info])
Returns an action that signals the next handle-jobs
up in the
item tree to execute a job with the given description. An arbitrary
info
value can be attached to distinguish separate jobs with the
same description (see job-info
).
Returns an action that signals the next [[handle-jobs]] up in the item tree to execute a job with the given description. An arbitrary `info` value can be attached to distinguish separate jobs with the same description (see [[job-info]]).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close