Quantum.Storage behaviour (Quantum v3.3.0) View Source

Bahaviour to be implemented by all Storage Adapters.

The calls to the storage are blocking, make sure they're fast to not block the job execution.

Link to this section Summary

Types

The location of the server.

Callbacks

Save new job in storage.

Storage child spec

Delete new job in storage.

Load saved jobs from storage.

Load last execution time from storage.

Purge all date from storage and go back to initial state.

Change Job State from given job.

Update last execution time to given date.

Link to this section Types

Specs

storage_pid() :: nil | GenServer.server()

The location of the server.

Values

  • nil if the storage was not started
  • server() if the storage was started

Link to this section Callbacks

Link to this callback

add_job(storage_pid, job)

View Source

Specs

add_job(storage_pid :: storage_pid(), job :: Quantum.Job.t()) :: :ok

Save new job in storage.

Specs

child_spec(init_arg :: Keyword.t()) :: Supervisor.child_spec()

Storage child spec

If the storage does not need a process, specify a function that returns :ignore.

Values

  • :scheduler - The Scheduler
Link to this callback

delete_job(storage_pid, job)

View Source

Specs

delete_job(storage_pid :: storage_pid(), job :: Quantum.Job.name()) :: :ok

Delete new job in storage.

Specs

jobs(storage_pid :: storage_pid()) :: :not_applicable | [Quantum.Job.t()]

Load saved jobs from storage.

Returns :not_applicable if the storage has never received an add_job call or after it has been purged. In this case the jobs from the configuration will be loaded.

Link to this callback

last_execution_date(storage_pid)

View Source

Specs

last_execution_date(storage_pid :: storage_pid()) ::
  :unknown | NaiveDateTime.t()

Load last execution time from storage.

Returns :unknown if the storage does not know the last execution time. In this case all jobs will be run at the next applicable date.

Specs

purge(storage_pid :: storage_pid()) :: :ok

Purge all date from storage and go back to initial state.

Link to this callback

update_job_state(storage_pid, job, state)

View Source

Specs

update_job_state(
  storage_pid :: storage_pid(),
  job :: Quantum.Job.name(),
  state :: Quantum.Job.state()
) :: :ok

Change Job State from given job.

Link to this callback

update_last_execution_date(storage_pid, last_execution_date)

View Source

Specs

update_last_execution_date(
  storage_pid :: storage_pid(),
  last_execution_date :: NaiveDateTime.t()
) :: :ok

Update last execution time to given date.