CAR (Content Addressable aRchive) file parser.
CAR files are used in Exosphere.ATProto to bundle multiple CBOR blocks together, typically containing record data and MST (Merkle Search Tree) nodes.
Format
A CAR file consists of:
- Header: varint-length-prefixed CBOR with
{version, roots} - Blocks: repeated
<varint-length><CID><data>entries
Usage
# Parse CAR blocks from firehose
{:ok, blocks} = Exosphere.ATProto.CAR.decode(car_binary)
# Get a specific record by CID
record = Exosphere.ATProto.CAR.get_block(blocks, cid)
Summary
Functions
Decode a CAR file into a map of CID → decoded data.
Get a block by CID from the parsed blocks map.
Types
@type block_map() :: %{required(Exosphere.ATProto.CID.t()) => term()}
Functions
Decode a CAR file into a map of CID → decoded data.
Returns {:ok, %{cid => data}} on success.
@spec get_block(block_map(), Exosphere.ATProto.CID.t() | String.t()) :: term() | nil
Get a block by CID from the parsed blocks map.
Returns the decoded CBOR data if found.