Durable job persistence with atomic lease and fencing transitions.
A worker may mutate a running job only while it owns the current fencing token and an unexpired lease. Expired work can be reclaimed, which increments the fencing token and makes every stale worker transition fail.
Summary
Functions
@spec claim(binary(), binary(), non_neg_integer(), pos_integer(), keyword()) :: {:ok, ExStorageService.Metadata.Models.Job.t()} | {:error, term()}
@spec complete(binary(), binary(), non_neg_integer(), non_neg_integer(), keyword()) :: {:ok, ExStorageService.Metadata.Models.Job.t()} | {:error, term()}
@spec fail( binary(), binary(), non_neg_integer(), term(), non_neg_integer(), keyword() ) :: {:ok, ExStorageService.Metadata.Models.Job.t()} | {:error, term()}
@spec get( binary(), keyword() ) :: {:ok, ExStorageService.Metadata.Models.Job.t()} | {:error, :not_found | term()}
@spec list_page(binary() | nil, pos_integer(), keyword()) :: {:ok, %{ jobs: [ExStorageService.Metadata.Models.Job.t()], next_cursor: binary() | nil }} | {:error, term()}
@spec renew( binary(), binary(), non_neg_integer(), non_neg_integer(), pos_integer(), keyword() ) :: {:ok, ExStorageService.Metadata.Models.Job.t()} | {:error, term()}