Jidoka.Handoff.OwnerStore behaviour (Jidoka v0.9.0)

Copy Markdown View Source

Storage boundary for conversation handoff owners.

The default store is process-local ETS for examples and tests. Applications that need durable or clustered ownership can configure another module:

config :jidoka, :handoff_owner_store, MyApp.HandoffOwnerStore

Summary

Callbacks

Returns the current owner record for a conversation.

Stores the handoff owner for a conversation.

Removes the handoff owner for a conversation.

Functions

Returns the current owner record from the configured store.

Stores a handoff owner when a conversation identifier is available.

Removes a handoff owner when a conversation identifier is valid.

Returns the configured owner-store module.

Types

owner()

@type owner() :: %{
  agent: module(),
  agent_id: String.t(),
  handoff: Jidoka.Handoff.t(),
  updated_at_ms: integer()
}

Callbacks

owner(t)

@callback owner(String.t()) :: owner() | nil

Returns the current owner record for a conversation.

put_owner(t, t)

@callback put_owner(String.t(), Jidoka.Handoff.t()) :: :ok

Stores the handoff owner for a conversation.

reset(t)

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

Removes the handoff owner for a conversation.

Functions

owner(conversation_id)

@spec owner(String.t()) :: owner() | nil

Returns the current owner record from the configured store.

put_owner(conversation_id, handoff)

@spec put_owner(String.t() | nil, Jidoka.Handoff.t()) :: :ok

Stores a handoff owner when a conversation identifier is available.

reset(conversation_id)

@spec reset(String.t()) :: :ok

Removes a handoff owner when a conversation identifier is valid.

store()

@spec store() :: module()

Returns the configured owner-store module.