APICronStoreMemory class

An in-memory APICronStore: for a single instance (and tests). Not shared between processes.

It keeps copies of the runs and locks, like a database: a run or lock returned is not changed by another scheduler using the same store.

Inheritance

Constructors

APICronStoreMemory()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

acquireLock(String job, String owner, Duration lease, {DateTime? now}) → APICronJobLock?
Acquires the lock of job for owner until now + lease: null if another owner holds it (not expired). An expired lock is taken over; a lock of owner is renewed.
override
claimRun(APICronJobRun run) → APICronJobRun?
Inserts run, claiming its occurrence: null if the occurrence already has a run (another instance claimed it).
override
deleteRunsBefore(String job, DateTime before) → int
Deletes the finished runs of job scheduled before before (never a APICronRunStatus.running one: it may be resumed). Returns the count.
override
getLock(String job) → APICronJobLock?
The lock of job, if any.
override
getRun(String job, DateTime scheduledAt) → APICronJobRun?
The run of the occurrence scheduledAt of job, if any.
override
lastRun(String job) → APICronJobRun?
The run of job with the latest APICronJobRun.scheduledAt.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseLock(APICronJobLock lock) → bool
Releases lock (only if still held by its owner).
override
renewLock(APICronJobLock lock, Duration lease, {DateTime? now}) → bool
Renews lock until now + lease: false if it's no longer held by its owner (lost: expired and taken over).
override
selectRunningRuns(String job) → List<APICronJobRun>
The runs of job with status APICronRunStatus.running.
override
selectRuns(String job, {int limit = 20}) → List<APICronJobRun>
The latest runs of job (latest first), at most limit.
override
toString() → String
A string representation of this object.
inherited
updateRun(APICronJobRun run, {String? previousOwner}) → bool
Updates the stored run, only if the stored one is still APICronRunStatus.running and owned by previousOwner (default: the APICronJobRun.owner of run; another owner when taking an interrupted run over). false otherwise: the run was taken over by another instance, finished or deleted, and must not be overwritten.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited