DripDrop.Scheduler behaviour (DripDrop v0.1.0)

Copy Markdown View Source

Behaviour for scheduling DripDrop step executions.

Summary

Functions

Returns the configured scheduler module.

Returns the short name (e.g. "pgflow", "oban") for the configured scheduler. Used to populate step_executions.scheduler_backend so a later cancel/replay routes to the correct backend even if the configured scheduler has been swapped.

Resolves a stored scheduler-backend name to its module.

Callbacks

cancel(job_id)

@callback cancel(job_id :: term()) :: :ok | {:error, term()}

schedule(execution, scheduled_for)

@callback schedule(execution :: term(), scheduled_for :: DateTime.t()) ::
  {:ok, term()} | {:error, term()}

Functions

configured()

@spec configured() :: module()

Returns the configured scheduler module.

configured_name()

@spec configured_name() :: binary()

Returns the short name (e.g. "pgflow", "oban") for the configured scheduler. Used to populate step_executions.scheduler_backend so a later cancel/replay routes to the correct backend even if the configured scheduler has been swapped.

module_for_backend(backend)

@spec module_for_backend(binary()) :: {:ok, module()} | {:error, :unknown_backend}

Resolves a stored scheduler-backend name to its module.