1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! gRPC server support for acton-service
//!
//! This module provides gRPC server functionality that can run alongside HTTP services.
//! It supports both single-port (HTTP + gRPC multiplexed) and dual-port modes.
//!
//! ## Middleware and Interceptors
//!
//! The gRPC implementation provides middleware parity with HTTP:
//! - **Request ID**: Automatic generation and propagation
//! - **Tracing**: OpenTelemetry integration with proper span context
//! - **Authentication**: PASETO (default) or JWT token validation via interceptors
//! - **Rate Limiting**: Governor-based rate limiting (when `governor` feature is enabled)
//!
//! ## Example
//!
//! ```ignore
//! use acton_service::grpc::interceptors::{request_id_interceptor, paseto_auth_interceptor};
//! use acton_service::grpc::middleware::GrpcTracingLayer;
//! use acton_service::middleware::PasetoAuth;
//! use std::sync::Arc;
//! use tonic::transport::Server;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Create PASETO auth
//! let paseto_auth = Arc::new(PasetoAuth::new(&config.token.unwrap())?);
//!
//! // Build gRPC service with interceptors
//! let service = MyServiceServer::with_interceptor(
//! service_impl,
//! move |req| {
//! let req = request_id_interceptor(req)?;
//! paseto_auth_interceptor(paseto_auth.clone())(req)
//! }
//! );
//!
//! // Serve
//! Server::builder()
//! .layer(GrpcTracingLayer)
//! .add_service(service)
//! .serve(addr)
//! .await?;
//! # Ok(())
//! # }
//! ```
// Re-exports
pub use GrpcServer;
pub use HealthService;
pub use ;
pub use jwt_auth_interceptor;
pub use ;
pub use ;
// Re-export tonic types for convenience
pub use ;