rs-zero 0.2.6

Rust-first microservice framework inspired by go-zero engineering practices
Documentation
use thiserror::Error;

/// Kubernetes adapter result type.
pub type KubeDiscoveryResult<T> = Result<T, KubeDiscoveryError>;

/// Kubernetes adapter errors.
#[derive(Debug, Error)]
pub enum KubeDiscoveryError {
    /// Fixture or API payload is invalid.
    #[error("kubernetes discovery payload error: {0}")]
    Payload(#[from] serde_json::Error),

    /// No port matched the configured selector.
    #[error("kubernetes endpoint has no matching port")]
    MissingPort,

    /// Adapter configuration is invalid.
    #[error("invalid kubernetes discovery configuration: {0}")]
    InvalidConfig(String),

    /// Kubernetes client creation failed.
    #[error("kubernetes client error: {0}")]
    Client(String),

    /// Kubernetes watch failed.
    #[error("kubernetes watch error: {0}")]
    Watch(String),

    /// Endpoint mapping failed.
    #[error("kubernetes mapping error: {0}")]
    Mapping(String),

    /// Watcher has not completed its initial synchronization.
    #[error("kubernetes watcher for `{service}` has not synchronized")]
    NotSynced { service: String },

    /// Kubernetes discovery operation timed out.
    #[error("kubernetes operation `{operation}` timed out")]
    Timeout { operation: &'static str },

    /// Backend operation failed.
    #[error("kubernetes backend error: {0}")]
    Backend(String),
}