barrel_vectordb_docstore behaviour (barrel_vectordb v2.1.1)

View Source

Document backend behaviour for barrel_vectordb.

A vector store keeps each vector's source text and metadata somewhere. By default (docstore => undefined) they live in the store's own RocksDB column families, written in the same atomic batch as the vector. Configuring an external docstore (for example barrel_vectordb_docdb_backend) routes text and metadata elsewhere; the vector itself always stays local so the ANN index can be rebuilt from it.

External backends are written after the vector batch commits (vector-first, doc-second), so a crash between the two can leave a vector without its text; the vector column family stays authoritative for rebuild.

Summary

Callbacks

delete/2

-callback delete(Ctx :: term(), Id :: binary()) -> ok | {error, term()}.

get/2

-callback get(Ctx :: term(), Id :: binary()) ->
                 {ok, Text :: binary(), Metadata :: map()} | not_found | {error, term()}.

init/2

-callback init(Name :: atom() | binary(), Config :: map()) -> {ok, Ctx :: term()} | {error, term()}.

multi_get/2

-callback multi_get(Ctx :: term(), [binary()]) -> [{ok, binary(), map()} | not_found | {error, term()}].

multi_put/2

-callback multi_put(Ctx :: term(), [{binary(), binary(), map()}]) -> ok | {error, term()}.

put/4

-callback put(Ctx :: term(), Id :: binary(), Text :: binary(), Metadata :: map()) -> ok | {error, term()}.

terminate/1

-callback terminate(Ctx :: term()) -> ok.