WardrikTriggers. Records
(wardrik_triggers v0.1.0-rc.1)
Copy Markdown
Stores triggers. Each record holds the trigger, its next and last run, and what its feeds and webhook have seen.
Summary
Functions
Returns every stored trigger as {agent_id, name}.
Deletes trigger name of agent_id.
Returns the record for trigger name of agent_id and its version, or nil.
Returns the record's next run, or nil for a webhook.
Returns the trigger names of agent_id.
Writes record if the stored version is vsn. Pass nil to create it.
Returns the record's trigger.
Updates the record with fun. Retries on a conflicting write.
Functions
@spec all(WardrikStore.t()) :: [{String.t(), String.t()}]
Returns every stored trigger as {agent_id, name}.
@spec delete(WardrikStore.t(), String.t(), String.t()) :: :ok | {:error, term()}
Deletes trigger name of agent_id.
@spec lookup(WardrikStore.t(), String.t(), String.t()) :: {map(), WardrikStore.vsn()} | nil
Returns the record for trigger name of agent_id and its version, or nil.
@spec next_at(map()) :: DateTime.t() | nil
Returns the record's next run, or nil for a webhook.
@spec of(WardrikStore.t(), String.t()) :: [String.t()]
Returns the trigger names of agent_id.
@spec put(WardrikStore.t(), map(), WardrikStore.vsn() | nil) :: :ok | {:error, :conflict | term()}
Writes record if the stored version is vsn. Pass nil to create it.
Returns {:error, :conflict} if the version differs.
@spec trigger(map()) :: WardrikTriggers.Trigger.t()
Returns the record's trigger.
Updates the record with fun. Retries on a conflicting write.
Returns {:error, :not_found} if there's no record.