barrel_path_dict (barrel_docdb v1.1.1)
View SourcePath ID Interning for barrel_docdb
Maps JSON paths to compact 32-bit integer IDs for efficient posting list keys. Uses ETS for read cache and RocksDB for persistence.
Path format: [<<"field1">>, <<"field2">>] to PathId (32-bit integer)
Summary
Functions
Clear cache entries for a database. Called when a database is closed or deleted.
Get path ID from cache only (no creation). Returns not_found if path is not in cache.
Get or create a path ID for the given path. If the path doesn't have an ID yet, creates one and persists it.
Get path from cache by ID. Returns undefined if ID is not in cache.
Load all path IDs from store into cache. Called when a database is opened.
Reset the path dictionary (for testing only).
Start the path dictionary server
Types
-type att_info() :: #{name := binary(), content_type := binary(), length := non_neg_integer(), digest := binary(), chunked => boolean(), chunk_size => pos_integer(), chunk_count => pos_integer()}.
-type change() :: map().
-type db_name() :: binary().
-type docid() :: binary().
-type path_id() :: non_neg_integer().
-type revid() :: binary().
-type seq() :: barrel_hlc:timestamp().
-type seq_string() :: binary().
-type view_name() :: binary().
Functions
-spec clear_cache(db_name()) -> ok.
Clear cache entries for a database. Called when a database is closed or deleted.
Get path ID from cache only (no creation). Returns not_found if path is not in cache.
-spec get_or_create_id(barrel_store_rocksdb:db_ref(), db_name(), path()) -> path_id().
Get or create a path ID for the given path. If the path doesn't have an ID yet, creates one and persists it.
-spec get_path(barrel_store_rocksdb:db_ref(), db_name(), path_id()) -> path() | undefined.
Get path from cache by ID. Returns undefined if ID is not in cache.
-spec load_from_store(barrel_store_rocksdb:db_ref(), db_name()) -> ok.
Load all path IDs from store into cache. Called when a database is opened.
-spec reset() -> ok.
Reset the path dictionary (for testing only).
Start the path dictionary server