Skip to main content

Module cap

Module cap 

Source
Expand description

Cap — cap enum + shared constants.

The four Cap variants live one-per-submodule under this directory: cnode, data, image, instance (plus page, a data detail). The root Cap enum dispatches to those structs.

Cap types and their inner storage use the default Global allocator (= std heap on host, talc on guest via #[global_allocator]).

§Wire form

Cap itself is the wire form. It derives rkyv::Archive/Serialize/Deserialize so callers write rkyv::to_bytes(&cap)? directly. The slot-target super::cache::CapHashOrRef has a hand-rolled rkyv impl whose Serialize returns an error (super::cache::CapHasRefError) if the cap graph still contains an inline Owned cap. The archived form of the Hash arm is [u8; 32] (= the CapHash archived form), so a settled cap graph serialises to a stable byte form and an Owned-bearing graph surfaces as a typed Result::Err at encode time (no panic).

See super::cache::CapRef for the (dormant) cache-handle lifecycle.

Modules§

cnode
CNodeCap — CNode cap: a sparse, Key-addressed key→cap map.
data
DataCap — backing (immutable dense page slab) + copy-on-write overlay.
image
ImageCap — Image cap.
instance
InstanceCap — Instance cap with mutable working state.
page
PageSlot and PageRef — DataCap page storage.

Enums§

ArchivedCap
An archived Cap
Cap
One of the four v3 cap kinds.
CapResolver
The resolver for an archived Cap

Constants§

MAX_SOURCE_DEPTH
Maximum depth of a MemoryMapping.source_path. v3 cap graphs stay shallow; eight is plenty.
NUM_REGS
Number of PVM general-purpose registers (φ[0]..φ[12]).

Type Aliases§

CapHash
32-byte digest used for all v3 cap identity / content hashes.