Packages
quantum
3.0.0
3.5.3
3.5.2
retired
3.5.1
retired
3.5.0
3.4.0
3.3.0
3.2.0
3.1.0
3.0.2
3.0.1
3.0.0
3.0.0-rc.3
3.0.0-rc.2
3.0.0-rc.1
2.4.0
2.3.4
2.3.3
2.3.2
2.3.1
retired
2.3.0
retired
2.2.7
2.2.6
2.2.5
retired
2.2.4
retired
2.2.3
retired
2.2.2
retired
2.2.1
retired
2.2.0
retired
2.1.3
retired
2.1.2
retired
2.1.1
retired
2.1.0
retired
2.1.0-beta.1
retired
2.0.4
retired
2.0.3
retired
2.0.2
retired
2.0.1
retired
2.0.0
retired
2.0.0-beta.2
retired
2.0.0-beta.1
retired
1.9.3
retired
1.9.2
retired
1.9.1
retired
1.9.0
retired
1.8.1
retired
1.8.0
retired
1.7.1
retired
1.7.0
retired
1.6.1
retired
1.6.0
retired
1.5.0
retired
1.4.0
retired
1.3.2
retired
1.3.1
retired
1.3.0
retired
1.2.4
retired
1.2.3
retired
1.2.2
retired
1.2.1
retired
1.2.0
retired
1.1.0
retired
1.0.4
retired
1.0.3
retired
1.0.2
retired
1.0.1
retired
1.0.0
retired
Cron-like job scheduler for Elixir.
Current section
Files
Jump to
Current section
Files
lib/quantum/storage.ex
defmodule Quantum.Storage do
@moduledoc """
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.
"""
alias Quantum.Job
@typedoc """
The location of the `server`.
### Values
* `nil` if the storage was not started
* `server()` if the storage was started
"""
@type storage_pid :: nil | GenServer.server()
@doc """
Storage child spec
If the storage does not need a process, specify a function that returns `:ignore`.
### Values
* `:scheduler` - The Scheduler
"""
@callback child_spec(init_arg :: Keyword.t()) :: Supervisor.child_spec()
@doc """
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.
"""
@callback jobs(storage_pid :: storage_pid) ::
:not_applicable | [Job.t()]
@doc """
Save new job in storage.
"""
@callback add_job(storage_pid :: storage_pid, job :: Job.t()) ::
:ok
@doc """
Delete new job in storage.
"""
@callback delete_job(storage_pid :: storage_pid, job :: Job.name()) :: :ok
@doc """
Change Job State from given job.
"""
@callback update_job_state(storage_pid :: storage_pid, job :: Job.name(), state :: Job.state()) ::
:ok
@doc """
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.
"""
@callback last_execution_date(storage_pid :: storage_pid) :: :unknown | NaiveDateTime.t()
@doc """
Update last execution time to given date.
"""
@callback update_last_execution_date(
storage_pid :: storage_pid,
last_execution_date :: NaiveDateTime.t()
) :: :ok
@doc """
Purge all date from storage and go back to initial state.
"""
@callback purge(storage_pid :: storage_pid) :: :ok
end