Skip to main content

RawPacket

Type Alias RawPacket 

Source
pub type RawPacket = MerkleNode<PacketBody>;
Expand description

The transparent decode target: an untrusted DAG node.

Deliberately the MerkleNode itself rather than a fresh DTO. A RawUnit had to be minted because a Unit is not structurally a plain record of its own fields; a raw packet is exactly a Merkle node with a PacketBody payload, and standing a second type up beside one that already has the right shape and the right wire form is the sprawl this crate is written against.

It asserts nothing: the parent set may hold any number of links, which is what gives TryFrom<RawPacket> for Packet something to refuse.

Aliased Type§

pub struct RawPacket {
    pub payload: PacketBody,
    pub parents: BTreeSet<ContentId>,
}

Fields§

§payload: PacketBody

The node’s content.

The field key string "payload" is load-bearing for the node’s id and part of the (non-frozen) byte layout — see the module docs.

§parents: BTreeSet<ContentId>

The causal parent links, as a deterministically-ordered, deduplicated set of [ContentId]s.

Each element serializes as a dag-cbor tag-42 link. The field key string "parents" is load-bearing for the node’s id and part of the (non-frozen) byte layout — see the module docs.