d-engine-proto 0.2.3

gRPC protocol definitions - for building non-Rust d-engine clients
Documentation
// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorMetadata {
    /// Errors suitable for retry
    #[prost(uint64, optional, tag = "1")]
    pub retry_after_ms: ::core::option::Option<u64>,
    /// Leader change information
    #[prost(string, optional, tag = "2")]
    pub leader_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "3")]
    pub leader_address: ::core::option::Option<::prost::alloc::string::String>,
    /// Error details (for debugging only)
    #[prost(string, optional, tag = "15")]
    pub debug_message: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ErrorCode {
    /// Success status (non-error)
    Success = 0,
    /// ======================
    /// Network layer error (1000-1999)
    /// ======================
    ConnectionTimeout = 1001,
    InvalidAddress = 1002,
    LeaderChanged = 1003,
    JoinError = 1004,
    /// ======================
    /// Protocol layer error (2000-2999)
    /// ======================
    InvalidResponse = 2001,
    VersionMismatch = 2002,
    /// ======================
    /// Storage layer error (3000-3999)
    /// ======================
    DiskFull = 3001,
    DataCorruption = 3002,
    StorageIoError = 3003,
    StoragePermissionDenied = 3004,
    KeyNotExist = 3005,
    /// ======================
    /// Business logic error (4000-4999)
    /// ======================
    NotLeader = 4001,
    StaleOperation = 4002,
    InvalidRequest = 4003,
    RateLimited = 4004,
    ClusterUnavailable = 4005,
    ProposeFailed = 4006,
    TermOutdated = 4007,
    RetryRequired = 4008,
    /// ======================
    /// Unclassified error
    /// ======================
    General = 8888,
    Uncategorized = 9999,
}
impl ErrorCode {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Success => "SUCCESS",
            Self::ConnectionTimeout => "CONNECTION_TIMEOUT",
            Self::InvalidAddress => "INVALID_ADDRESS",
            Self::LeaderChanged => "LEADER_CHANGED",
            Self::JoinError => "JOIN_ERROR",
            Self::InvalidResponse => "INVALID_RESPONSE",
            Self::VersionMismatch => "VERSION_MISMATCH",
            Self::DiskFull => "DISK_FULL",
            Self::DataCorruption => "DATA_CORRUPTION",
            Self::StorageIoError => "STORAGE_IO_ERROR",
            Self::StoragePermissionDenied => "STORAGE_PERMISSION_DENIED",
            Self::KeyNotExist => "KEY_NOT_EXIST",
            Self::NotLeader => "NOT_LEADER",
            Self::StaleOperation => "STALE_OPERATION",
            Self::InvalidRequest => "INVALID_REQUEST",
            Self::RateLimited => "RATE_LIMITED",
            Self::ClusterUnavailable => "CLUSTER_UNAVAILABLE",
            Self::ProposeFailed => "PROPOSE_FAILED",
            Self::TermOutdated => "TERM_OUTDATED",
            Self::RetryRequired => "RETRY_REQUIRED",
            Self::General => "GENERAL",
            Self::Uncategorized => "UNCATEGORIZED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SUCCESS" => Some(Self::Success),
            "CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout),
            "INVALID_ADDRESS" => Some(Self::InvalidAddress),
            "LEADER_CHANGED" => Some(Self::LeaderChanged),
            "JOIN_ERROR" => Some(Self::JoinError),
            "INVALID_RESPONSE" => Some(Self::InvalidResponse),
            "VERSION_MISMATCH" => Some(Self::VersionMismatch),
            "DISK_FULL" => Some(Self::DiskFull),
            "DATA_CORRUPTION" => Some(Self::DataCorruption),
            "STORAGE_IO_ERROR" => Some(Self::StorageIoError),
            "STORAGE_PERMISSION_DENIED" => Some(Self::StoragePermissionDenied),
            "KEY_NOT_EXIST" => Some(Self::KeyNotExist),
            "NOT_LEADER" => Some(Self::NotLeader),
            "STALE_OPERATION" => Some(Self::StaleOperation),
            "INVALID_REQUEST" => Some(Self::InvalidRequest),
            "RATE_LIMITED" => Some(Self::RateLimited),
            "CLUSTER_UNAVAILABLE" => Some(Self::ClusterUnavailable),
            "PROPOSE_FAILED" => Some(Self::ProposeFailed),
            "TERM_OUTDATED" => Some(Self::TermOutdated),
            "RETRY_REQUIRED" => Some(Self::RetryRequired),
            "GENERAL" => Some(Self::General),
            "UNCATEGORIZED" => Some(Self::Uncategorized),
            _ => None,
        }
    }
}