Expand description
§xds-server
xDS gRPC server implementation for control planes.
This crate provides the gRPC server layer for xDS:
XdsServer- Main server type wrapping all xDS servicesXdsServerBuilder- Builder for configuring the server- State-of-the-World (SotW) protocol support
- Delta xDS protocol support (incremental updates)
- Health checking via gRPC health protocol
- Prometheus metrics for observability
- Graceful shutdown with connection draining
- Connection tracking and limits
§Example
use xds_server::XdsServerBuilder;
use xds_cache::ShardedCache;
use std::sync::Arc;
let cache = Arc::new(ShardedCache::new());
let server = XdsServerBuilder::new()
.cache(cache)
.enable_sotw()
.enable_delta()
.enable_health_check()
.enable_metrics()
.build()?;
// Use with tonic - includes health and metrics
server.serve("[::]:18000".parse()?).await?;§Production Features
§Health Checking
The server implements the gRPC health checking protocol:
let _server = XdsServerBuilder::new()
.cache(cache)
.enable_health_check()
.build()?;
// Health status is managed automatically
// Available at grpc.health.v1.Health/Check§Metrics
Prometheus metrics are exposed for monitoring:
let _server = XdsServerBuilder::new()
.cache(cache)
.enable_metrics()
.build()?;§Graceful Shutdown
The server supports graceful shutdown with connection draining:
use std::time::Duration;
let _server = XdsServerBuilder::new()
.cache(cache)
.graceful_shutdown(Duration::from_secs(30))
.build()?;
// Server will drain connections on SIGTERM/SIGINTRe-exports§
pub use connections::ConnectionGuard;pub use connections::ConnectionLimits;pub use connections::ConnectionTracker;pub use health::HealthConfig;pub use health::HealthService;pub use metrics::XdsMetrics;pub use reflection::ReflectionConfig;reflectionpub use reflection::ReflectionService;reflectionpub use shutdown::ShutdownConfig;pub use shutdown::ShutdownController;
Modules§
- connections
- Connection tracking and limits.
- health
- Health service for gRPC health checking protocol.
- metrics
- Prometheus metrics for xDS server.
- reflection
- gRPC Server Reflection support for xDS services.
- services
- gRPC service implementations for xDS.
- shutdown
- Graceful shutdown handling for the xDS server.
- streaming
- Shared streaming helpers for xDS discovery services.
- utils
- Shared utilities for xds-server.
Structs§
- Server
Config - Configuration for the xDS server.
- Server
TlsConfig tls - Configures TLS settings for servers.
- Stream
Context - Context for an active xDS stream.
- Stream
Id - Unique identifier for a stream.
- TlsIdentity
tls - Represents a private key and X509 certificate.
- XdsServer
- The main xDS server.
- XdsServer
Builder - Builder for creating an
XdsServer.