ringkernel_core/
lib.rs

1//! # RingKernel Core
2//!
3//! Core traits and types for the RingKernel GPU-native persistent actor system.
4//!
5//! This crate provides the foundational abstractions for building GPU-accelerated
6//! actor systems with persistent kernels, lock-free message passing, and hybrid
7//! logical clocks for temporal ordering.
8//!
9//! ## Core Abstractions
10//!
11//! - [`RingMessage`] - Trait for messages between kernels
12//! - [`MessageQueue`] - Lock-free ring buffer for message passing
13//! - [`RingKernelRuntime`] - Backend-agnostic runtime management
14//! - [`RingContext`] - GPU intrinsics facade for kernel handlers
15//! - [`HlcTimestamp`] - Hybrid Logical Clock for causal ordering
16//!
17//! ## Example
18//!
19//! ```ignore
20//! use ringkernel_core::prelude::*;
21//!
22//! #[derive(RingMessage)]
23//! struct MyMessage {
24//!     #[message(id)]
25//!     id: MessageId,
26//!     payload: Vec<f32>,
27//! }
28//! ```
29
30#![warn(missing_docs)]
31#![warn(clippy::all)]
32#![deny(unsafe_op_in_unsafe_fn)]
33
34pub mod context;
35pub mod control;
36pub mod error;
37pub mod hlc;
38pub mod k2k;
39pub mod memory;
40pub mod message;
41pub mod multi_gpu;
42pub mod pubsub;
43pub mod queue;
44pub mod runtime;
45pub mod telemetry;
46pub mod telemetry_pipeline;
47pub mod types;
48
49/// Private module for proc macro integration.
50/// Not part of the public API - exposed for macro-generated code only.
51#[doc(hidden)]
52pub mod __private;
53
54/// Prelude module for convenient imports
55pub mod prelude {
56    pub use crate::context::*;
57    pub use crate::control::*;
58    pub use crate::error::*;
59    pub use crate::hlc::*;
60    pub use crate::k2k::{
61        DeliveryStatus, K2KBroker, K2KBuilder, K2KConfig, K2KEndpoint, K2KMessage,
62    };
63    pub use crate::memory::*;
64    pub use crate::message::{
65        priority, CorrelationId, MessageEnvelope, MessageHeader, MessageId, Priority, RingMessage,
66    };
67    pub use crate::multi_gpu::{
68        DeviceInfo, DeviceStatus, LoadBalancingStrategy, MultiGpuBuilder, MultiGpuCoordinator,
69    };
70    pub use crate::pubsub::{PubSubBroker, PubSubBuilder, Publication, QoS, Subscription, Topic};
71    pub use crate::queue::*;
72    pub use crate::runtime::*;
73    pub use crate::telemetry::*;
74    pub use crate::telemetry_pipeline::{
75        MetricsCollector, MetricsSnapshot, TelemetryAlert, TelemetryConfig, TelemetryEvent,
76        TelemetryPipeline,
77    };
78    pub use crate::types::*;
79}
80
81// Re-exports for convenience
82pub use context::RingContext;
83pub use control::ControlBlock;
84pub use error::{Result, RingKernelError};
85pub use hlc::HlcTimestamp;
86pub use memory::{DeviceMemory, GpuBuffer, MemoryPool, PinnedMemory};
87pub use message::{priority, MessageHeader, MessageId, Priority, RingMessage};
88pub use queue::{MessageQueue, QueueStats};
89pub use runtime::{
90    Backend, KernelHandle, KernelId, KernelState, KernelStatus, LaunchOptions, RingKernelRuntime,
91};
92pub use telemetry::TelemetryBuffer;
93pub use types::{BlockId, GlobalThreadId, ThreadId, WarpId};