Skip to content

IJobScheduleStore

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The store for schedule definitions.

public interface IJobScheduleStore

Separate from IJobStore: this store holds only the definitions (when, what runs); the actual queued jobs are in IJobStore. The split is the same as between IWorkflowDefinitionStore and IWorkflowCheckpointStore.

DeleteAsync(string, string, CancellationToken)

Section titled “ DeleteAsync(string, string, CancellationToken)”

Deletes the schedule.

ValueTask<bool> DeleteAsync(string tenantId, string name, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

name string

The schedule name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if the delete happened.

GetAsync(string, string, CancellationToken)

Section titled “ GetAsync(string, string, CancellationToken)”

Fetches the schedule with the given name.

ValueTask<JobSchedule?> GetAsync(string tenantId, string name, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

name string

The schedule name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<JobSchedule?>

The schedule; null if it does not exist.

Lists all of a tenant’s schedules, by name.

ValueTask<IReadOnlyList<JobSchedule>> ListAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<JobSchedule>>

The schedules.

ListDueAsync(DateTimeOffset, CancellationToken)

Section titled “ ListDueAsync(DateTimeOffset, CancellationToken)”

Lists the schedules of every tenant that are due to run (NextRunAt <= asOfUtc), enabled, and carry a cron expression.

ValueTask<IReadOnlyList<JobSchedule>> ListDueAsync(DateTimeOffset asOfUtc, CancellationToken cancellationToken = default)

asOfUtc DateTimeOffset

The comparison moment (UTC).

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<JobSchedule>>

The due schedules.

SaveAsync(JobSchedule, CancellationToken)

Section titled “ SaveAsync(JobSchedule, CancellationToken)”

Creates or updates the schedule (name + tenant is unique).

ValueTask<JobSchedule> SaveAsync(JobSchedule schedule, CancellationToken cancellationToken = default)

schedule JobSchedule

The schedule to save.

cancellationToken CancellationToken

The cancellation token.

ValueTask<JobSchedule>

The saved schedule.

TryClaimNextRunAsync(Guid, DateTimeOffset, DateTimeOffset, DateTimeOffset, CancellationToken)

Section titled “ TryClaimNextRunAsync(Guid, DateTimeOffset, DateTimeOffset, DateTimeOffset, CancellationToken)”

Tries to atomically advance a schedule’s JobSchedule.NextRunAt field (compare-and-swap).

ValueTask<bool> TryClaimNextRunAsync(Guid scheduleId, DateTimeOffset expectedNextRunAt, DateTimeOffset newNextRunAt, DateTimeOffset ranAt, CancellationToken cancellationToken = default)

scheduleId Guid

The schedule identifier.

expectedNextRunAt DateTimeOffset

The expected current value. If another instance has already advanced it, the value does not match and the operation fails — this is how two overlapping scheduling triggers are prevented.

newNextRunAt DateTimeOffset

The new next-run time.

ranAt DateTimeOffset

The time this trigger happened (UTC).

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if the claim succeeded.