Skip to main content

laminar_core/numa/
error.rs

1//! # NUMA Error Types
2//!
3//! Error types for NUMA-aware memory operations.
4
5/// Errors that can occur during NUMA operations.
6#[derive(Debug, thiserror::Error)]
7pub enum NumaError {
8    /// Allocation failed
9    #[error("NUMA allocation failed: {0}")]
10    AllocationFailed(String),
11
12    /// Invalid NUMA node
13    #[error("Invalid NUMA node: {node} (system has {available} nodes)")]
14    InvalidNode {
15        /// The requested node
16        node: usize,
17        /// Number of available nodes
18        available: usize,
19    },
20
21    /// Invalid CPU ID
22    #[error("Invalid CPU ID: {cpu} (system has {available} CPUs)")]
23    InvalidCpu {
24        /// The requested CPU
25        cpu: usize,
26        /// Number of available CPUs
27        available: usize,
28    },
29
30    /// Memory binding failed
31    #[error("Memory binding failed: {0}")]
32    BindFailed(String),
33
34    /// Topology detection failed
35    #[error("Topology detection failed: {0}")]
36    TopologyError(String),
37
38    /// System call failed
39    #[error("System call failed: {0}")]
40    SyscallFailed(#[from] std::io::Error),
41
42    /// NUMA not available on this platform
43    #[error("NUMA not available on this platform")]
44    NotAvailable,
45}