solo library

One job at a time: sequential jobs with exclusive state ownership, declarative rules and cooperative cancellation.

Classes

AccumulationTiming
Controls when accumulated event groups become ready to run.
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.
ClosedCancelReason
Solo.close, or Solo.enqueueJob after close.
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.
DuplicateCancelReason
Solo.enqueueJob under Policy.droppable found a job with the same key, handed that one back and dropped this one before its body ran.
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.
JobContext
What a job body sees in the core: cancellation, waiting and children.
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.
ReplacedCancelReason
Solo.enqueueJob under Policy.keepLatest or Policy.restart put a newer job with the same key in this one's place: took it out of the queue, or, under restart, cancelled it while it ran.
RulesCancelReason
canStart, state is! W, keepWhile, or SoloContext.stateAs failed.
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.
Solo<S extends Object>
The engine: state, queue, hooks and its own listeners: addListener, and addChangeListener for a listener that takes the two states of a change.
SoloAccumulator<E, T>
A controller-bound factory of queued groups with fixed rules and handler.
SoloCancelReason
The base for reasons added by solo and engines built on it.
SoloContext<S extends Object, W extends S>
The core context plus the state: what a job body of solo sees.
SoloJob<T>
A job of a controller: Job plus the queue.
SoloObserver
Cross-cutting hooks for every controller: analytics, error reporting, a single log.
SoloPending
What is holding the controller right now: a snapshot for whoever is looking at a close that has not come back, taken by Solo.pending.
SoloPendingJob
A job the controller is waiting for, and what it is doing as far as the engine knows.
SoloPendingQueue
A drain with no job running: the queue it has still to run holds the close.
SoloPendingStream
The engine has closed, and the stream of SoloStream waits for a subscription to take its done event: one left paused holds close until it is resumed or cancelled.
SoloQueue
The queue of a controller, visible to its subclasses.
SoloTransition<S extends Object>
One state change, with who made it.
TimeoutCancelReason
The job ran out of the time it was given with timeout.

Enums

AccumulationPolicy
Chooses which waiting group receives an event and where it runs.
JobErrorAnswer
What the job does about an error it hands to JobObserver.onError.
Policy
How Solo.enqueueJob treats jobs with the same key.
SoloCloseMode
What Solo.close does with the work the controller already has.
SoloPhase
What a job the controller is waiting for is doing, as far as the engine knows.

Mixins

JobAnswerer
An observer that answers for the errors nobody else has: those no outcome carries, and a failure whose outcome nobody observes.
SoloStream<S extends Object>
Adds a broadcast stream of states to Solo.

Typedefs

SoloUnansweredHandler = void Function(Solo<Object> solo, Job<Object?> job, Object error, StackTrace stackTrace)
Answers for an error that has nowhere else to go; see Solo.unansweredHandler.

Exceptions / Errors

Cancelled
The job was cancelled before or during its run.