barrel_doc_body_store (barrel_docdb v1.1.1)
View SourceDocument body storage using body column family (BlobDB enabled)
Document bodies are stored in the "bodies" column family which has BlobDB enabled. This keeps the main LSM tree lean (only indexes and metadata) and provides efficient batch fetching with multi_get.
The store is accessed via persistent_term registry using the db name.
Summary
Functions
Get a specific revision body (archived, non-current revisions).
Get the current body for a document. Since current body is stored without revision in key, no rev needed.
Batch get specific revision bodies (for archived revisions). DocIdRevPairs is a list of {DocId, RevId} tuples.
Batch get current bodies for multiple documents. Much faster than multi_get_bodies since we don't need to know revisions. Uses short_range read profile by default.
Batch get current bodies with explicit read profile. Read profiles optimize I/O based on batch size: - point: Small batches (<50), cache friendly - short_range: Medium batches (50-200), auto readahead - long_scan: Large batches (>200), prefetch 2MB, avoid cache pollution
Batch get current bodies with snapshot for consistent reads. Uses short_range read profile by default.
Batch get current bodies with snapshot and explicit read profile. Use this for query execution to ensure consistent reads across batches.
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 read_profile() :: barrel_store_rocksdb:read_profile().
-type revid() :: binary().
-type seq() :: barrel_hlc:timestamp().
-type seq_string() :: binary().
-type snapshot() :: barrel_store_rocksdb:snapshot().
-type view_name() :: binary().
Functions
Get a specific revision body (archived, non-current revisions).
Get the current body for a document. Since current body is stored without revision in key, no rev needed.
-spec multi_get_bodies(db_name(), [{docid(), revid()}], map()) -> [{ok, binary()} | not_found | {error, term()}].
Batch get specific revision bodies (for archived revisions). DocIdRevPairs is a list of {DocId, RevId} tuples.
-spec multi_get_current_bodies(db_name(), [docid()]) -> [{ok, binary()} | not_found | {error, term()}].
Batch get current bodies for multiple documents. Much faster than multi_get_bodies since we don't need to know revisions. Uses short_range read profile by default.
-spec multi_get_current_bodies(db_name(), [docid()], read_profile()) -> [{ok, binary()} | not_found | {error, term()}].
Batch get current bodies with explicit read profile. Read profiles optimize I/O based on batch size: - point: Small batches (<50), cache friendly - short_range: Medium batches (50-200), auto readahead - long_scan: Large batches (>200), prefetch 2MB, avoid cache pollution
-spec multi_get_current_bodies_with_snapshot(db_name(), [docid()], snapshot()) -> [{ok, binary()} | not_found | {error, term()}].
Batch get current bodies with snapshot for consistent reads. Uses short_range read profile by default.
-spec multi_get_current_bodies_with_snapshot(db_name(), [docid()], snapshot(), read_profile()) -> [{ok, binary()} | not_found | {error, term()}].
Batch get current bodies with snapshot and explicit read profile. Use this for query execution to ensure consistent reads across batches.