View Source Vettore.Store behaviour (Vettore v0.3.1)

Storage behaviour for Vettore collections.

Stores own records and metadata. Indexes and native accelerators are separate from this layer so ETS can remain the canonical source of collection state.

Link to this section Summary

Link to this section Types

@type config() :: map()
@type id() :: String.t()
@type state() :: term()

Link to this section Callbacks

@callback all(state()) :: {:ok, [Vettore.Embedding.t()]} | {:error, term()}
@callback count(state()) :: non_neg_integer()
@callback delete(state(), id()) :: :ok | {:error, term()}
Link to this callback

fold(state, acc, function)

View Source
@callback fold(state(), acc, (Vettore.Embedding.t(), acc -> acc)) :: {:ok, acc}
when acc: term()
@callback get(state(), id()) :: {:ok, Vettore.Embedding.t()} | {:error, term()}
@callback load_snapshot(Path.t()) :: {:ok, {state(), config()}} | {:error, term()}
@callback new(config()) :: {:ok, state()} | {:error, term()}
@callback put(state(), Vettore.Embedding.t()) :: :ok | {:error, term()}
@callback put_many(state(), [Vettore.Embedding.t()]) :: :ok | {:error, term()}
@callback snapshot(state(), Path.t()) :: :ok | {:error, term()}