Skip to main content

Module wire

Module wire 

Source
Expand description

Wire-form caps for the host ↔ guest put_cap RPC.

Cap and its inner types use the SSZ derive macro for content hashing and carry rkyv-incompatible fields (SparseList in CNodeCap, Arc<PageBytes> in PageSlot::Loaded). Adding rkyv derives there would either require hand-written Archive / Serialize / Deserialize impls for those types or a transformation wrapper. We pick a third option: a sibling enum whose shape mirrors Cap but flattens or omits the unsupported fields, with explicit From<&Cap> / TryInto<Cap> conversions at the wire boundary.

§V0 limitations

  • WireCap::CNode only carries materialized Hash slot entries. SparseList cached-subtree-roots and MissingOr::Missing(_) placeholders are dropped on the wire; the receiver reconstructs a fresh CNodeCap without them. Ref(_) slot targets are rejected (WireConvertError::CapHasRef) because the receiver has no way to resolve them in its own CapRef namespace.
  • WireCap::Data only supports DataContent::Inline. The Paged variant errors out (WireConvertError::PagedData) — PageRef = Arc<PageBytes> doesn’t archive cleanly and the V0 bench guests don’t need it.
  • WireCap::Instance only carries Hash root_cnode (no live Ref targets, same reasoning as CNode).

These limits cover the smoke-test path (Image + empty CNode + Instance with no rw_overlays containing Refs) and are tightened at the type level: the wire types simply don’t have fields for the unsupported shapes.

Structs§

ArchivedWireCNodeCap
An archived WireCNodeCap
ArchivedWireCNodeSlot
An archived WireCNodeSlot
ArchivedWireDataCap
An archived WireDataCap
ArchivedWireEndpointDef
An archived WireEndpointDef
ArchivedWireImageCap
An archived WireImageCap
ArchivedWireImageSlotEntry
An archived WireImageSlotEntry
ArchivedWireInstanceCap
An archived WireInstanceCap
ArchivedWireMemoryMapping
An archived WireMemoryMapping
ArchivedWireRwOverlay
An archived WireRwOverlay
ArchivedWireTypeCap
An archived WireTypeCap
WireCNodeCap
Wire form of CNodeCap. Flat list of (slot, hash) pairs; only materialized Hash slot entries are carried.
WireCNodeCapResolver
The resolver for an archived WireCNodeCap
WireCNodeSlot
WireCNodeSlotResolver
The resolver for an archived WireCNodeSlot
WireDataCap
Wire form of DataCap. V0: inline-only.
WireDataCapResolver
The resolver for an archived WireDataCap
WireEndpointDef
WireEndpointDefResolver
The resolver for an archived WireEndpointDef
WireImageCap
Wire form of ImageCap. Direct field-for-field mirror — all inner types are derive-compatible already.
WireImageCapResolver
The resolver for an archived WireImageCap
WireImageSlotEntry
WireImageSlotEntryResolver
The resolver for an archived WireImageSlotEntry
WireInstanceCap
Wire form of InstanceCap. root_cnode collapses CapHashOrRef down to a plain hash (V0: refs unsupported).
WireInstanceCapResolver
The resolver for an archived WireInstanceCap
WireMemoryMapping
WireMemoryMappingResolver
The resolver for an archived WireMemoryMapping
WireRwOverlay
WireRwOverlayResolver
The resolver for an archived WireRwOverlay
WireTypeCap
WireTypeCapResolver
The resolver for an archived WireTypeCap

Enums§

ArchivedWireCap
An archived WireCap
WireCap
Wire-shaped cap. Derives rkyv::{Archive, Serialize, Deserialize} using only alloc::Vec/Box and plain repr(C) fields. The shape mirrors Cap but with the constraints called out in the module docs.
WireCapResolver
The resolver for an archived WireCap
WireConvertError
Failures the wire-form conversion can produce. All non-fatal: they indicate the cap shape isn’t supported on the V0 RPC path.

Functions§

box_from_wire
Box-ed convenience: produce a Box<Cap> from an archived WireCap. Used by the guest’s put_cap RPC handler to deposit the decoded cap into its directory.