Skip to main content

rvm_types/
lib.rs

1//! # RVM Core Types
2//!
3//! Foundation types for the RVM (`RuVix` Virtual Machine) coherence-native
4//! microhypervisor, as specified in ADR-132, ADR-133, and ADR-134. This
5//! crate has minimal external dependencies and provides the type vocabulary
6//! shared by all RVM crates.
7//!
8//! ## First-Class Objects (ADR-132)
9//!
10//! | Type | Purpose |
11//! |------|---------|
12//! | [`PartitionId`] | Coherence domain container; unit of scheduling, isolation, and migration |
13//! | [`Capability`] | Unforgeable authority token; grants specific rights over specific objects |
14//! | [`WitnessRecord`] | 64-byte audit record emitted by every privileged action |
15//! | [`MemoryRegion`] | Typed, tiered, owned memory range with explicit lifetime |
16//! | [`CommEdge`] | Inter-partition communication channel; weighted edge in the coherence graph |
17//! | [`DeviceLease`] | Time-bounded, revocable access grant to a hardware device |
18//! | [`CoherenceScore`] | Locality and coupling metric derived from the coherence graph |
19//! | [`CutPressure`] | Graph-derived isolation signal; high pressure triggers migration or split |
20//! | [`RecoveryCheckpoint`] | State snapshot for rollback and reconstruction |
21//!
22//! ## Design Constraints
23//!
24//! - `#![no_std]` with zero heap allocation in the default configuration
25//! - `#![forbid(unsafe_code)]` -- all types are safe Rust
26//! - All identifiers are `Copy + Clone + Eq + Hash`-compatible newtypes
27
28#![no_std]
29#![forbid(unsafe_code)]
30#![deny(missing_docs)]
31#![deny(clippy::all)]
32#![warn(clippy::pedantic)]
33
34#[cfg(feature = "alloc")]
35extern crate alloc;
36
37#[cfg(feature = "std")]
38extern crate std;
39
40mod addr;
41mod capability;
42mod coherence;
43mod config;
44mod device;
45mod error;
46mod ids;
47mod memory;
48mod partition;
49mod proof;
50mod recovery;
51mod scheduler;
52mod witness;
53
54// --- Address types ---
55pub use addr::{GuestPhysAddr, PhysAddr, VirtAddr};
56
57// --- Identifier types ---
58pub use ids::{PartitionId, VcpuId};
59
60// --- Capability types ---
61pub use capability::{
62    CapRights, CapToken, CapType, Capability, CapabilityId, MAX_DELEGATION_DEPTH,
63};
64
65// --- Witness types ---
66pub use witness::{
67    fnv1a_32, fnv1a_64, ActionKind, WitnessHash, WitnessRecord, WITNESS_RECORD_SIZE,
68    WITNESS_RING_CAPACITY,
69};
70
71// --- Coherence types ---
72pub use coherence::{CoherenceScore, CommEdge, CommEdgeId, CutPressure, PhiValue};
73
74// --- Partition types ---
75pub use partition::{
76    PartitionConfig, PartitionState, PartitionType, MAX_DEVICES_PER_PARTITION,
77    MAX_EDGES_PER_PARTITION, MAX_PARTITIONS,
78};
79
80// --- Memory types ---
81pub use memory::{MemoryRegion, MemoryTier, OwnedRegionId, RegionPlacementWeights, RegionPolicy};
82
83// --- Device types ---
84pub use device::{DeviceClass, DeviceLease, DeviceLeaseId, GpuMemoryType, GpuQueuePriority};
85
86// --- Proof types ---
87pub use proof::{ProofResult, ProofTier, ProofToken};
88
89// --- Scheduler types ---
90pub use scheduler::{EpochConfig, EpochSummary, Priority, SchedulerMode};
91
92// --- Recovery types ---
93pub use recovery::{FailureClass, ReconstructionReceipt, RecoveryCheckpoint};
94
95// --- Configuration ---
96pub use config::RvmConfig;
97
98// --- Error types ---
99pub use error::{RvmError, RvmResult};