rvm_types/partition.rs
1//! Partition configuration types (shared across crates).
2
3use crate::CoherenceScore;
4
5/// Maximum partitions per RVM instance.
6pub const MAX_PARTITIONS: usize = 256;
7
8/// Maximum communication edges per partition.
9pub const MAX_EDGES_PER_PARTITION: usize = 64;
10
11/// Maximum device leases per partition.
12pub const MAX_DEVICES_PER_PARTITION: usize = 16;
13
14/// Partition lifecycle state.
15#[derive(Debug, Clone, Copy, PartialEq, Eq)]
16pub enum PartitionState {
17 /// Created but not yet running.
18 Created,
19 /// Actively running.
20 Running,
21 /// Suspended (all vCPUs paused).
22 Suspended,
23 /// Destroyed and resources reclaimed.
24 Destroyed,
25 /// Hibernated to cold storage.
26 Hibernated,
27}
28
29/// Partition type classification.
30#[derive(Debug, Clone, Copy, PartialEq, Eq)]
31pub enum PartitionType {
32 /// Normal agent workload.
33 Agent,
34 /// Infrastructure (driver domain, service partition).
35 Infrastructure,
36 /// Root partition (bootstrap authority).
37 Root,
38}
39
40/// Partition creation configuration.
41#[derive(Debug, Clone, Copy)]
42pub struct PartitionConfig {
43 /// Number of vCPUs.
44 pub vcpu_count: u16,
45 /// Initial coherence score.
46 pub initial_coherence: CoherenceScore,
47 /// CPU affinity bitmask.
48 pub cpu_affinity: u64,
49 /// Partition type.
50 pub partition_type: PartitionType,
51}
52
53impl Default for PartitionConfig {
54 fn default() -> Self {
55 Self {
56 vcpu_count: 1,
57 initial_coherence: CoherenceScore::from_basis_points(5000),
58 cpu_affinity: u64::MAX,
59 partition_type: PartitionType::Agent,
60 }
61 }
62}