ringkernel_ecosystem/
lib.rs

1//! Ecosystem integrations for RingKernel.
2//!
3//! This crate provides optional integrations with popular Rust ecosystem
4//! libraries for actors, web frameworks, data processing, and observability.
5//!
6//! # Feature Flags
7//!
8//! All integrations are opt-in via feature flags:
9//!
10//! - `actix` - Actix actor framework bridge
11//! - `tower` - Tower service middleware integration
12//! - `axum` - Axum web framework integration
13//! - `arrow` - Apache Arrow data processing
14//! - `polars` - Polars DataFrame operations
15//! - `grpc` - gRPC server via Tonic
16//! - `candle` - Candle ML framework bridge
17//! - `config` - Configuration file management
18//! - `tracing-integration` - Enhanced tracing support
19//! - `prometheus` - Prometheus metrics export
20//! - `full` - All integrations enabled
21//!
22//! # Example
23//!
24//! ```toml
25//! [dependencies]
26//! ringkernel-ecosystem = { version = "0.1", features = ["axum", "prometheus"] }
27//! ```
28
29#![warn(missing_docs)]
30#![warn(clippy::all)]
31
32pub mod error;
33
34#[cfg(feature = "persistent")]
35pub mod persistent;
36
37#[cfg(feature = "persistent-cuda")]
38pub mod cuda_bridge;
39
40#[cfg(feature = "actix")]
41pub mod actix;
42
43#[cfg(feature = "tower")]
44pub mod tower;
45
46#[cfg(feature = "axum")]
47pub mod axum;
48
49#[cfg(feature = "arrow")]
50pub mod arrow;
51
52#[cfg(feature = "polars")]
53pub mod polars;
54
55#[cfg(feature = "grpc")]
56pub mod grpc;
57
58#[cfg(feature = "candle")]
59pub mod candle;
60
61#[cfg(feature = "config")]
62pub mod config;
63
64#[cfg(feature = "tracing-integration")]
65pub mod tracing_ext;
66
67#[cfg(feature = "prometheus")]
68pub mod metrics;
69
70/// Prelude for convenient imports.
71///
72/// Note: Each integration module defines its own `RuntimeHandle` trait with
73/// different bounds. To avoid conflicts, import the specific `RuntimeHandle`
74/// from the module you're using (e.g., `use ringkernel_ecosystem::axum::RuntimeHandle`).
75pub mod prelude {
76    pub use crate::error::*;
77
78    #[cfg(feature = "persistent")]
79    pub use crate::persistent::*;
80
81    // Re-export commonly used types, excluding RuntimeHandle to avoid conflicts
82    #[cfg(feature = "actix")]
83    pub use crate::actix::{
84        BridgeHealth, GpuActorBridge, GpuActorConfig, GpuActorExt, GpuRequest, GpuResponse,
85        HealthCheck, TypedGpuRequest,
86    };
87    #[cfg(all(feature = "actix", feature = "persistent"))]
88    pub use crate::actix::{
89        GetStatsCmd, GpuPersistentActor, GpuPersistentActorExt, InjectCmd, PauseCmd,
90        PersistentActorConfig, PersistentResponseMsg, ResumeCmd, RunStepsCmd, ShutdownCmd,
91        Subscribe, Unsubscribe,
92    };
93
94    #[cfg(all(feature = "tower", feature = "persistent"))]
95    pub use crate::tower::{
96        PersistentKernelLayer, PersistentKernelService, PersistentServiceBuilder,
97        PersistentServiceConfig, PersistentServiceRequest, PersistentServiceResponse,
98    };
99    #[cfg(feature = "tower")]
100    pub use crate::tower::{
101        RingKernelLayer, RingKernelService, ServiceBuilder, ServiceConfig, ServiceRequest,
102        ServiceResponse,
103    };
104
105    #[cfg(feature = "axum")]
106    pub use crate::axum::{
107        gpu_handler, health_handler, ApiRequest, ApiResponse, AppState, AxumConfig, HealthResponse,
108        KernelHealth, RequestStats, RouterBuilder, StatsSnapshot,
109    };
110    #[cfg(all(feature = "axum", feature = "persistent"))]
111    pub use crate::axum::{
112        impulse_handler, pause_handler, persistent_health_handler, persistent_stats_handler,
113        resume_handler, step_handler, CommandResponse, ImpulseRequest, PersistentAxumConfig,
114        PersistentGpuState, PersistentHealthResponse, PersistentStatsResponse, StepRequest,
115    };
116
117    #[cfg(feature = "persistent-cuda")]
118    pub use crate::cuda_bridge::{CudaPersistentHandle, CudaPersistentHandleBuilder};
119
120    #[cfg(feature = "arrow")]
121    pub use crate::arrow::*;
122
123    #[cfg(feature = "polars")]
124    pub use crate::polars::*;
125
126    #[cfg(feature = "grpc")]
127    pub use crate::grpc::*;
128
129    #[cfg(feature = "candle")]
130    pub use crate::candle::*;
131
132    #[cfg(feature = "config")]
133    pub use crate::config::*;
134
135    #[cfg(feature = "prometheus")]
136    pub use crate::metrics::*;
137}