Skip to main content

d_engine_proto/generated/
d_engine.common.error.rs

1// This file is @generated by prost-build.
2#[derive(serde::Serialize, serde::Deserialize)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ErrorMetadata {
5    /// Errors suitable for retry
6    #[prost(uint64, optional, tag = "1")]
7    pub retry_after_ms: ::core::option::Option<u64>,
8    /// Leader change information
9    #[prost(string, optional, tag = "2")]
10    pub leader_id: ::core::option::Option<::prost::alloc::string::String>,
11    #[prost(string, optional, tag = "3")]
12    pub leader_address: ::core::option::Option<::prost::alloc::string::String>,
13    /// Error details (for debugging only)
14    #[prost(string, optional, tag = "15")]
15    pub debug_message: ::core::option::Option<::prost::alloc::string::String>,
16}
17#[derive(serde::Serialize, serde::Deserialize)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
19#[repr(i32)]
20pub enum ErrorCode {
21    /// Success status (non-error)
22    Success = 0,
23    /// ======================
24    /// Network layer error (1000-1999)
25    /// ======================
26    ConnectionTimeout = 1001,
27    InvalidAddress = 1002,
28    LeaderChanged = 1003,
29    JoinError = 1004,
30    /// ======================
31    /// Protocol layer error (2000-2999)
32    /// ======================
33    InvalidResponse = 2001,
34    VersionMismatch = 2002,
35    /// ======================
36    /// Storage layer error (3000-3999)
37    /// ======================
38    DiskFull = 3001,
39    DataCorruption = 3002,
40    StorageIoError = 3003,
41    StoragePermissionDenied = 3004,
42    KeyNotExist = 3005,
43    /// ======================
44    /// Business logic error (4000-4999)
45    /// ======================
46    NotLeader = 4001,
47    StaleOperation = 4002,
48    InvalidRequest = 4003,
49    RateLimited = 4004,
50    ClusterUnavailable = 4005,
51    ProposeFailed = 4006,
52    TermOutdated = 4007,
53    RetryRequired = 4008,
54    /// ======================
55    /// Watch layer error (5000-5999)
56    /// ======================
57    /// per-watcher channel full; watcher forcibly canceled, client must re-sync
58    WatchBufferOverflow = 5001,
59    /// ======================
60    /// Unclassified error
61    /// ======================
62    General = 8888,
63    Uncategorized = 9999,
64}
65impl ErrorCode {
66    /// String value of the enum field names used in the ProtoBuf definition.
67    ///
68    /// The values are not transformed in any way and thus are considered stable
69    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
70    pub fn as_str_name(&self) -> &'static str {
71        match self {
72            Self::Success => "SUCCESS",
73            Self::ConnectionTimeout => "CONNECTION_TIMEOUT",
74            Self::InvalidAddress => "INVALID_ADDRESS",
75            Self::LeaderChanged => "LEADER_CHANGED",
76            Self::JoinError => "JOIN_ERROR",
77            Self::InvalidResponse => "INVALID_RESPONSE",
78            Self::VersionMismatch => "VERSION_MISMATCH",
79            Self::DiskFull => "DISK_FULL",
80            Self::DataCorruption => "DATA_CORRUPTION",
81            Self::StorageIoError => "STORAGE_IO_ERROR",
82            Self::StoragePermissionDenied => "STORAGE_PERMISSION_DENIED",
83            Self::KeyNotExist => "KEY_NOT_EXIST",
84            Self::NotLeader => "NOT_LEADER",
85            Self::StaleOperation => "STALE_OPERATION",
86            Self::InvalidRequest => "INVALID_REQUEST",
87            Self::RateLimited => "RATE_LIMITED",
88            Self::ClusterUnavailable => "CLUSTER_UNAVAILABLE",
89            Self::ProposeFailed => "PROPOSE_FAILED",
90            Self::TermOutdated => "TERM_OUTDATED",
91            Self::RetryRequired => "RETRY_REQUIRED",
92            Self::WatchBufferOverflow => "WATCH_BUFFER_OVERFLOW",
93            Self::General => "GENERAL",
94            Self::Uncategorized => "UNCATEGORIZED",
95        }
96    }
97    /// Creates an enum from field names used in the ProtoBuf definition.
98    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
99        match value {
100            "SUCCESS" => Some(Self::Success),
101            "CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout),
102            "INVALID_ADDRESS" => Some(Self::InvalidAddress),
103            "LEADER_CHANGED" => Some(Self::LeaderChanged),
104            "JOIN_ERROR" => Some(Self::JoinError),
105            "INVALID_RESPONSE" => Some(Self::InvalidResponse),
106            "VERSION_MISMATCH" => Some(Self::VersionMismatch),
107            "DISK_FULL" => Some(Self::DiskFull),
108            "DATA_CORRUPTION" => Some(Self::DataCorruption),
109            "STORAGE_IO_ERROR" => Some(Self::StorageIoError),
110            "STORAGE_PERMISSION_DENIED" => Some(Self::StoragePermissionDenied),
111            "KEY_NOT_EXIST" => Some(Self::KeyNotExist),
112            "NOT_LEADER" => Some(Self::NotLeader),
113            "STALE_OPERATION" => Some(Self::StaleOperation),
114            "INVALID_REQUEST" => Some(Self::InvalidRequest),
115            "RATE_LIMITED" => Some(Self::RateLimited),
116            "CLUSTER_UNAVAILABLE" => Some(Self::ClusterUnavailable),
117            "PROPOSE_FAILED" => Some(Self::ProposeFailed),
118            "TERM_OUTDATED" => Some(Self::TermOutdated),
119            "RETRY_REQUIRED" => Some(Self::RetryRequired),
120            "WATCH_BUFFER_OVERFLOW" => Some(Self::WatchBufferOverflow),
121            "GENERAL" => Some(Self::General),
122            "UNCATEGORIZED" => Some(Self::Uncategorized),
123            _ => None,
124        }
125    }
126}