View Source Kvasir.Agent.Cache behaviour (kvasir_agent v0.0.18)

Link to this section Summary

Link to this section Types

Link to this section Callbacks

Link to this callback

cache(agent, partition, id)

View Source
@callback cache(agent :: module(), partition :: non_neg_integer(), id :: term()) ::
  {:ok, ref()}
@callback delete(ref()) :: :ok | {:error, atom()}
Link to this callback

init(agent, partition, opts)

View Source
@callback init(agent :: module(), partition :: non_neg_integer(), opts :: Keyword.t()) ::
  :ok | {:ok, map()}
@callback load(ref()) ::
  {:ok, Kvasir.Offset.t(), map()} | :no_previous_state | {:error, atom()}
Link to this callback

save(cache, data, offset)

View Source
@callback save(
  cache :: ref(),
  data :: map(),
  offset :: Kvasir.Offset.t()
) :: :ok | {:error, atom()}
@callback stream(agent :: module()) :: Enumerable.t()
@callback track_command(ref()) :: :ok | {:error, atom()}