feat: port el-ui vessels — rename crates→vessels, add El source + manifests
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
//! el-services — Service bindings for el-ui.
|
||||
//!
|
||||
//! Write once. Bind to any protocol. Change the binding in `el.toml`.
|
||||
//!
|
||||
//! ```toml
|
||||
//! [services.UserService]
|
||||
//! binding = "rest"
|
||||
//! base_url = "https://api.example.com"
|
||||
//! auth = "bearer"
|
||||
//! ```
|
||||
//!
|
||||
//! Switch `binding = "grpc"` and the same service code now speaks gRPC. No rewrite.
|
||||
|
||||
pub mod binding;
|
||||
pub mod config;
|
||||
pub mod proxy;
|
||||
pub mod registry;
|
||||
|
||||
pub use binding::{
|
||||
direct::DirectBinding,
|
||||
grpc::GrpcBinding,
|
||||
rest::RestBinding,
|
||||
websocket::WebSocketBinding,
|
||||
Binding, BindingKind, ServiceRequest, ServiceResponse,
|
||||
};
|
||||
pub use config::{AuthConfig, ServiceConfig};
|
||||
pub use proxy::{ServiceMethod, ServiceProxy};
|
||||
pub use registry::ServiceRegistry;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ServiceError {
|
||||
#[error("service not found: {0}")]
|
||||
NotFound(String),
|
||||
#[error("binding error: {0}")]
|
||||
Binding(String),
|
||||
#[error("serialization error: {0}")]
|
||||
Serialization(String),
|
||||
#[error("transport error: {0}")]
|
||||
Transport(String),
|
||||
#[error("auth error: {0}")]
|
||||
Auth(String),
|
||||
#[error("method not found: {method} on service {service}")]
|
||||
MethodNotFound { service: String, method: String },
|
||||
}
|
||||
|
||||
pub type ServiceResult<T> = Result<T, ServiceError>;
|
||||
Reference in New Issue
Block a user