Skip to main content

dope_core/driver/settings/
errors.rs

1//! Driver configuration failures.
2
3use o3::buffer::storage::Zero;
4
5use crate::{
6    driver::{route, route::table, settings, settings::demands::slots},
7    io::datagram::payload,
8};
9
10/// Failure to construct a representable driver plan.
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12#[repr(u8)]
13pub enum Config {
14    QueueSubmissionsOutOfRange {
15        actual: u32,
16        minimum: u32,
17        maximum: u32,
18    },
19    ReceiveEntriesOutOfRange {
20        actual: u32,
21        minimum: u32,
22        maximum: u32,
23    },
24    ReceiveBuffer(Zero),
25    DatagramPayload(payload::Error),
26    DescriptorCapacityOutOfRange {
27        accepted: u32,
28        outbound: u32,
29        actual: u64,
30        minimum: u32,
31        maximum: u32,
32    },
33    ReadyCapacity {
34        files: u32,
35        ready: u32,
36        maximum: u32,
37    },
38}
39
40#[derive(Clone, Copy, Debug, Eq, PartialEq)]
41#[repr(u8)]
42pub enum Claim {
43    DuplicateRoute(route::Id),
44    AcceptedDescriptorsOverflow {
45        current: u32,
46        added: u32,
47    },
48    OutboundDescriptorsOverflow {
49        current: u32,
50        added: u32,
51    },
52    DescriptorConnectionsOutOfRange {
53        actual: usize,
54        minimum: usize,
55        maximum: usize,
56    },
57    ReceiveEntriesOverflow {
58        current: u32,
59        added: u32,
60    },
61    ResidentDomainsOverflow(settings::DomainSum),
62    QueueSubmissionsPowerOfTwoOverflow {
63        requested: u32,
64    },
65    SchedulerReadyOverflow(slots::Sum),
66    SchedulerTimersOverflow(slots::Sum),
67    Layout(Config),
68}
69
70impl From<Config> for Claim {
71    fn from(source: Config) -> Self {
72        Self::Layout(source)
73    }
74}
75
76impl From<settings::DomainSum> for Claim {
77    fn from(source: settings::DomainSum) -> Self {
78        Self::ResidentDomainsOverflow(source)
79    }
80}
81
82impl From<table::Invalid> for Claim {
83    fn from(source: table::Invalid) -> Self {
84        Self::DescriptorConnectionsOutOfRange {
85            actual: source.actual,
86            minimum: source.minimum,
87            maximum: source.maximum,
88        }
89    }
90}