Ferricstore.Flow.Schedule (ferricstore v0.5.4)

Copy Markdown View Source

Durable FerricFlow schedules.

Schedules are stored as internal Flow records and fired by claiming due schedule records. That keeps scheduling distributed-safe without a second coordination path: only the shard leader can lease a due schedule, and every fire/reschedule is still guarded by Flow fencing tokens.

Summary

Types

schedule_id()

@type schedule_id() :: binary()

Functions

create(ctx, id, opts)

@spec create(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  {:ok, map()} | {:error, binary()}

delete(ctx, id, opts \\ [])

@spec delete(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  :ok | {:error, binary()}

fire(ctx, id, opts \\ [])

@spec fire(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  {:ok, map()} | {:error, binary()}

fire_due(ctx, opts \\ [])

@spec fire_due(
  FerricStore.Instance.t(),
  keyword()
) :: {:ok, map()} | {:error, binary()}

get(ctx, id, opts \\ [])

@spec get(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  {:ok, map() | nil} | {:error, binary()}

list(ctx, opts \\ [])

@spec list(
  FerricStore.Instance.t(),
  keyword()
) :: {:ok, [map()]} | {:error, binary()}

pause(ctx, id, opts \\ [])

@spec pause(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  {:ok, map()} | {:error, binary()}

resume(ctx, id, opts \\ [])

@spec resume(FerricStore.Instance.t(), schedule_id(), keyword()) ::
  {:ok, map()} | {:error, binary()}