vura.sync.jobs

add-phase

(add-phase job new-phase [function validator])
Functions adds phase to the end
of the phase chain that completes
job

defjob

macro

(defjob name & phases)
Defines job shell that represents blueprint for
successively executing functions that are defined
as transitions from phase to phase. Transitions are
valid if validator function returns true or if
validator is not defined.

depend-on

(depend-on check-timer & jobs)
depend-on function is wrapper for job
validator, that ties execution of next
phase to successfull finish of other
jobs.

insert-phase

(insert-phase job new-phase at-phase function validator)
Inserts new phase after at-phase

job

(job j)(job j & params)
Returns real Job record with life. It
is possible to initialize data for job.
Pass in params after job definition.

job-life

(job-life x)

JobActions

protocol

members

reset-job!

(reset-job! this)(reset-job! this params)
Returns job to initialized state. Optional parameter
params is for data initialization.

start!

(start! this)
Starts Job. That is sends-off job-agent to do the job. If Job
was previously stoped than it continues from last phase.

stop!

(stop! this)
Stops running Job. Job will allways try to complete current phase.
If validator doesn't allow execution to continue than Job is stoped
at current phase.

JobInfo

protocol

members

active?

(active? this)
Returns true if job is running

after-phase?

(after-phase? this phase)
Returns boolean true if current phase that job-agent is working on is before input phase

at-phase?

(at-phase? this)
Returns current phase that job-agent is working on

before-phase?

(before-phase? this phase)
Returns boolean true if current phase that job-agent is working on is before input phase

duration?

(duration? this)
Returns duration of job in milliseconds

ended-at?

(ended-at? this)
Returns timestamp

finished?

(finished? this)
Returns true is job is in :finished state

get-phases

(get-phases this)
Lists all Job phases

in-error?

(in-error? this)
Returns error exception if it happend. Otherwise nil

started-at?

(started-at? this)
Returns timestamp

started?

(started? thsi)
Returns true if job is not in phase start

make-job-shell

(make-job-shell phases)

remove-phase

(remove-phase job phase)
Removes phase from job

reset-jobs

(reset-jobs & jobs)
Returns function that takes one parameter
and returns the same parameter. In mean time
it resets all jobs that are put in as jobs
argument of this function

restart-job!

(restart-job! job)
Restarts job combining functions stop! restart-job!
start!

restart-jobs

(restart-jobs & jobs)
Returns function that takes one parameter
and returns the same parameter. In mean time
it restarts all jobs that are put in as jobs
argument of this function

start-jobs

(start-jobs & jobs)
Returns function that takes one parameter
and returns the same parameter. In mean time
it starts all jobs that are put in as jobs
argument of this function

stop-jobs

(stop-jobs & jobs)
Returns function that takes one parameter
and returns the same parameter. In mean time
it stops all jobs that are put in as jobs
argument of this function

wait-for

(wait-for check-timer)(wait-for check-timer condition)
Wait for is another wrapper that can
be used as validator for job. It periodicaly
checks if condition fn or condition is valid
and. If condition is not provided than it is true.