d_engine_proto/generated/
d_engine.common.error.rs1#[derive(serde::Serialize, serde::Deserialize)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ErrorMetadata {
5 #[prost(uint64, optional, tag = "1")]
7 pub retry_after_ms: ::core::option::Option<u64>,
8 #[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 #[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 = 0,
23 ConnectionTimeout = 1001,
27 InvalidAddress = 1002,
28 LeaderChanged = 1003,
29 JoinError = 1004,
30 InvalidResponse = 2001,
34 VersionMismatch = 2002,
35 DiskFull = 3001,
39 DataCorruption = 3002,
40 StorageIoError = 3003,
41 StoragePermissionDenied = 3004,
42 KeyNotExist = 3005,
43 NotLeader = 4001,
47 StaleOperation = 4002,
48 InvalidRequest = 4003,
49 RateLimited = 4004,
50 ClusterUnavailable = 4005,
51 ProposeFailed = 4006,
52 TermOutdated = 4007,
53 RetryRequired = 4008,
54 WatchBufferOverflow = 5001,
59 General = 8888,
63 Uncategorized = 9999,
64}
65impl ErrorCode {
66 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 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}