Documentation ¶
Overview ¶
Package car implements the CARv1 file format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IdentityCID cid.Cid
IdentityCID is the "zero-length "identity" multihash with "raw" codec".
This is the best-practices placeholder value to refer to a non-existent or unknown object.
Functions ¶
This section is empty.
Types ¶
type Block ¶
Block is a length-cid-data tuple. These make up most of CARv1.
See https://ipld.io/specs/transport/car/carv1/#data
func NewBlockFromCBOR ¶
func NewBlockFromRaw ¶
NewBlockFromRaw creates a new CIDv1 with the given multicodec contentType on the fly.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer produces CARv1 files with size tracking.
The implementation is kinda memory-efficient. Needs up to IPLD block size plus peanuts of memory.
Rationale ¶
github.com/ipld/go-car/v2 is not helpful because it wants to traverse a complete IPLD link system. However we create an IPLD link system (Merkle-DAG) on the fly in a single pass as we read the chain. CARv1 is simple enough that we can roll a custom block writer, so no big deal.
func (*Writer) WriteBlock ¶
WriteBlock writes out a length-CID-value tuple.