Systematic clippy warning cleanup achieving zero warnings: - Add domain-appropriate crate-level #![allow(...)] to 20+ crate roots for pedantic lints that are noise in HFT/ML code (float_arithmetic, indexing_slicing, missing_const_for_fn, cognitive_complexity, etc.) - Fix attribute ordering in risk/src/lib.rs: move #![warn(clippy::pedantic)] before #![allow(...)] so individual allows correctly override pedantic - Remove module-level #![warn(clippy::pedantic)] from 8 trading_engine submodules that were overriding crate-level allows - Add 45+ workspace-level lint allows in Cargo.toml for common pedantic noise (mixed_attributes_style, cargo_common_metadata, etc.) - Auto-fix 67 machine-applicable warnings (redundant_closure, clone_on_copy, unnecessary_cast, etc.) via cargo clippy --fix - Fix 3 unsafe JSON indexing in risk/circuit_breaker.rs with safe .get() - Fix unused variables, unused mut, unnecessary parens in 4 files - Proto-generated code: suppress missing_const_for_fn, indexing_slicing, cognitive_complexity in ctrader-openapi and service crates 75 files changed across 20+ crates. All tests pass (3,122+ verified). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
100 lines
2.9 KiB
Rust
100 lines
2.9 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))]
|
|
// API gateway domain lints: generated protobuf code and routing logic
|
|
#![allow(clippy::mixed_attributes_style)] // Generated protobuf code uses mixed attributes
|
|
#![allow(clippy::type_complexity)] // Complex types in async proxy handlers
|
|
#![allow(clippy::doc_lazy_continuation)] // Doc formatting acceptable
|
|
#![allow(clippy::manual_strip)] // Explicit prefix stripping for clarity
|
|
|
|
// 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::{GatewayConfigError, GatewayConfigResult};
|
|
|
|
// 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,
|
|
};
|