View Source Kvasir.Agent.Cache behaviour (kvasir_agent v0.0.18)
Link to this section Summary
Link to this section Types
@type ref() :: term()
Link to this section Callbacks
@callback cache(agent :: module(), partition :: non_neg_integer(), id :: term()) :: {:ok, ref()}
@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()}
@callback save( cache :: ref(), data :: map(), offset :: Kvasir.Offset.t() ) :: :ok | {:error, atom()}
@callback stream(agent :: module()) :: Enumerable.t()