engine library

The protocol for building an engine on the core: JobBase, JobContextBase and JobStatus, together with everything package:async_job/async_job.dart exports.

An engine imports this library in place of the main one. An app that only runs jobs never needs it, and keeping it apart keeps the protected machinery of the core out of every file that merely starts a job.

The protocol is outside the semantic versioning of the package: it can change in a minor release, so an engine holds async_job to one minor version.

Classes

BodyCancelReason
The body cancelled itself, directly or by letting a child's cancellation escape.
CancelReason
Why a job was cancelled, with any data the reason needs.
ChainCancelReason
A cancellation forwarded between jobs connected by Job.then, or from a source to a handle of Job.shared.
ChildJob<T>
A job a parent may start: JobContext.run and JobContext.runAll take nothing else.
DeferredJob<T>
A job that starts when it is told to: by hand, through start, or by a parent, through JobContext.run.
Done<T>
The job body completed and returned value.
Failed
The job body threw error, or an engine ended the job with it by hand.
Job<T>
A handle to a job: the outcome, the waiting and the cancellation.
JobBase<T>
The lifecycle of a job: start, body, children, cancellation, outcome.
JobContext
What a job body sees in the core: cancellation, waiting and children.
JobContextBase
The base of a job context: everything a body does without a state.
JobObserver
Cross-cutting hooks of a single job: analytics, error reporting, a log.
ManualCancelReason
An explicit cancellation: the default reason of Job.cancel.
Outcome<T>
The result of a job: Done, Failed or Cancelled.
ParentCancelReason
A cancellation cascaded from the parent job.
SiblingCancelReason
A branch of JobContext.runAll was stopped because its group is failing: another branch of the group ended in an error or a cancellation, or the group itself hit an error, such as a job it refused to take as a branch.
TimeoutCancelReason
The job ran out of the time it was given with timeout.

Enums

JobErrorAnswer
What the job does about an error it hands to JobObserver.onError.
JobStatus
Where a job is in its life.

Mixins

JobAnswerer
An observer that answers for the errors nobody else has: those no outcome carries, and a failure whose outcome nobody observes.

Exceptions / Errors

Cancelled
The job was cancelled before or during its run.