barrel_vectordb_store (barrel_vectordb v2.1.2)
View SourceVector store gen_server managing RocksDB and HNSW index
Uses RocksDB column families: - vectors: chunk_id → binary float32 array - metadata: chunk_id → term_to_binary(map) - text: chunk_id → UTF-8 binary - hnsw_graph: node_id → serialized HNSW node
Summary
Functions
Add a chunk with auto-embedding
Add a chunk with explicit vector
Get chunk count
Delete a chunk
Get a chunk by ID
Get DiskANN ID mapping database handles Returns {ok, {Db, CfFwd, CfRev}} | {error, not_started}
Get store info
Rebuild HNSW index from stored vectors
Search for similar chunks
Search for similar chunks with options
Start the vector store
Stop the vector store
Types
-type metadata() :: #{file => binary(), start_line => pos_integer(), end_line => pos_integer(), type => atom(), atom() => term()}.
Functions
Add a chunk with auto-embedding
Add a chunk with explicit vector
-spec count() -> non_neg_integer().
Get chunk count
Delete a chunk
Get a chunk by ID
-spec get_diskann_db() -> {ok, {rocksdb:db_handle(), rocksdb:cf_handle(), rocksdb:cf_handle()}} | {error, term()}.
Get DiskANN ID mapping database handles Returns {ok, {Db, CfFwd, CfRev}} | {error, not_started}
-spec info() -> map().
Get store info
-spec rebuild_index() -> ok | {error, term()}.
Rebuild HNSW index from stored vectors
-spec search(binary() | [float()], pos_integer()) -> {ok, [search_result()]} | {error, term()}.
Search for similar chunks
-spec search(binary() | [float()], pos_integer(), map()) -> {ok, [search_result()]} | {error, term()}.
Search for similar chunks with options
Start the vector store
-spec stop() -> ok.
Stop the vector store