Add #![deny(clippy::unwrap_used, clippy::expect_used)] to api_gateway and backtesting_service crate roots. The ml and common crates already had these deny attributes. Production code fixes: - api_gateway: replace expect with unwrap_or for cache stats and LRU eviction - api_gateway: add #[allow] on NonZeroU32 constants and Prometheus metrics - backtesting_service: replace expect/unwrap with ok_or_else/? for OHLCV bar bounds checks and chrono timestamp resampling - backtesting_service: add #[allow] on Prometheus Lazy metric statics Test code: cfg_attr(test, allow) at crate root for both crates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
2.6 KiB
Rust
95 lines
2.6 KiB
Rust
//! API Gateway for Foxhunt HFT Trading System
|
|
//!
|
|
//! Provides zero-copy gRPC proxying with:
|
|
//! - RBAC authorization with sub-100ns cached permission checks
|
|
//! - <10μs routing overhead
|
|
//! - Connection pooling
|
|
//! - Circuit breaker pattern
|
|
//! - Health checking
|
|
//! - Performance monitoring
|
|
//! - Token bucket rate limiting with <50ns cache hits
|
|
|
|
#![deny(clippy::unwrap_used, clippy::expect_used)]
|
|
#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
|
|
|
|
// Include generated protobuf code FIRST (needed by other modules)
|
|
pub mod foxhunt {
|
|
pub mod tli {
|
|
tonic::include_proto!("foxhunt.tli");
|
|
}
|
|
pub mod config_proto {
|
|
tonic::include_proto!("foxhunt.config");
|
|
}
|
|
}
|
|
|
|
pub mod ml_training {
|
|
tonic::include_proto!("ml_training");
|
|
}
|
|
|
|
// Trading Agent Service proto (for proxy)
|
|
pub mod trading_agent {
|
|
tonic::include_proto!("trading_agent");
|
|
}
|
|
|
|
// Trading Service backend proto (for protocol translation)
|
|
pub mod trading_backend {
|
|
tonic::include_proto!("trading");
|
|
}
|
|
|
|
// Risk Service backend proto
|
|
pub mod risk {
|
|
tonic::include_proto!("risk");
|
|
}
|
|
|
|
// Monitoring Service backend proto
|
|
pub mod monitoring {
|
|
tonic::include_proto!("monitoring");
|
|
}
|
|
|
|
// Config Service backend proto
|
|
pub mod config_backend {
|
|
tonic::include_proto!("config");
|
|
}
|
|
|
|
// Error module MUST come before modules that use it
|
|
pub mod error;
|
|
|
|
// Now other modules can use error types and proto definitions
|
|
pub mod auth;
|
|
pub mod config;
|
|
pub mod grpc;
|
|
pub mod handlers;
|
|
pub mod health_router;
|
|
pub mod metrics;
|
|
pub mod routing;
|
|
|
|
// Re-export error types
|
|
pub use error::{ConfigError, ConfigResult};
|
|
|
|
// Re-export configuration management types
|
|
pub use config::{
|
|
AuthzMetrics, AuthzService, ConfigItem, ConfigValidator, ConfigurationManager,
|
|
ConfigurationServiceImpl, PermissionResult,
|
|
};
|
|
|
|
// Re-export routing and rate limiting types
|
|
pub use routing::{CacheStats, RateLimitConfig, RateLimiter};
|
|
|
|
// Re-export gRPC proxy types
|
|
pub use grpc::{
|
|
setup_ml_training_client, setup_ml_training_proxy, setup_trading_agent_client,
|
|
setup_trading_agent_proxy, BacktestingServiceProxy, HealthChecker, MlTradingProxy,
|
|
MlTrainingBackendConfig, MlTrainingProxy, TradingAgentBackendConfig, TradingAgentProxy,
|
|
TradingServiceProxy,
|
|
};
|
|
|
|
// Re-export health router types
|
|
pub use health_router::{health_router, HealthState};
|
|
|
|
// Re-export REST API handlers
|
|
pub use handlers::{
|
|
jwt_auth_middleware, ml_router, AuthMiddlewareState, BatchPredictRequest, BatchPredictResponse,
|
|
HotSwapRequest, HotSwapResponse, MlHandlerState, ModelStatusResponse, PredictRequest,
|
|
PredictResponse,
|
|
};
|