Kathikon.Backend.Storage behaviour (Kathikon v0.1.0)

Copy Markdown View Source

Storage behaviour for job persistence.

Configure the implementation via config :kathikon, storage_backend: module. Phase 1 ships Kathikon.Backend.Storage.Mnesia.

Summary

Callbacks

all()

@callback all() :: [Kathikon.Job.t()]

claim(atom, t)

@callback claim(atom(), DateTime.t()) ::
  {:ok, Kathikon.Job.t()} | :not_found | {:error, term()}

clear_jobs!()

@callback clear_jobs!() :: :ok

delete(t)

@callback delete(String.t()) :: :ok

fetch(t)

@callback fetch(String.t()) :: {:ok, Kathikon.Job.t()} | {:error, term()}

insert(t)

@callback insert(Kathikon.Job.t()) :: {:ok, Kathikon.Job.t()} | {:error, term()}

promote_scheduled(t)

@callback promote_scheduled(DateTime.t()) :: non_neg_integer()

prunable_jobs(t)

@callback prunable_jobs(DateTime.t()) :: [Kathikon.Job.t()]

reset!()

@callback reset!() :: :ok

setup()

@callback setup() :: :ok

update(t)

@callback update(Kathikon.Job.t()) :: {:ok, Kathikon.Job.t()} | {:error, term()}