From c3a1c4eb3b705d5ef62ec0484d78dd5bc5f8f73c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Feb 2026 22:59:27 +0000 Subject: [PATCH] feat: upgrade to RingKernel 0.4.2 with deep integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrade from ringkernel 0.3.1 to 0.4.2 with comprehensive integration: - Bump all workspace crate versions to 0.4.0 - Add bidirectional Domain conversion (Domain <-> ringkernel_core::Domain) with correct mapping (TemporalAnalysis↔TimeSeries, RiskAnalytics↔RiskManagement, Core↔General) - Remap ring message type IDs to 0.4.2 domain ranges: Graph 200→100, ML 700→200, Temporal 400→1100, Risk 600→400 - Add ringkernel-core 0.4.2 enterprise re-exports in security, observability, resilience, and memory modules (ring_security, ring_health, ring_observability, etc.) - Re-export new 0.4.2 types: ControlBlock, Backend, KernelStatus, RuntimeMetrics, K2KConfig, DeliveryStatus, Priority - Expose full ringkernel-core API via `rustkernel_core::ring` module - Add checkpoint, dispatcher, health, pubsub submodule re-exports - Update prelude with new 0.4.2 types - Update CLAUDE.md documentation for 0.4.0 All 895 tests pass, zero clippy warnings. https://claude.ai/code/session_01Duj97yQCCfNvKV9tizq22m --- CLAUDE.md | 79 ++++++-- Cargo.lock | 58 +++--- Cargo.toml | 66 +++---- crates/rustkernel-core/src/domain.rs | 169 +++++++++++++++++- crates/rustkernel-core/src/lib.rs | 42 ++++- crates/rustkernel-core/src/memory/mod.rs | 5 + .../rustkernel-core/src/observability/mod.rs | 7 + crates/rustkernel-core/src/resilience/mod.rs | 5 + crates/rustkernel-core/src/runtime/mod.rs | 2 +- crates/rustkernel-core/src/security/mod.rs | 8 + crates/rustkernel-derive/src/lib.rs | 9 + crates/rustkernel-graph/src/ring_messages.rs | 48 ++--- crates/rustkernel-ml/src/ring_messages.rs | 42 ++--- crates/rustkernel-risk/src/ring_messages.rs | 40 ++--- .../rustkernel-temporal/src/ring_messages.rs | 50 +++--- 15 files changed, 458 insertions(+), 172 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 9db294e..e3a4d9a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,9 +8,9 @@ RustKernels is a GPU-accelerated kernel library for financial services, analytic **Current State**: 106 kernels across 14 domain crates, fully implemented with both Batch and Ring execution modes. -**Version**: 0.3.1 - Enterprise-ready with security, observability, resilience, and service APIs. +**Version**: 0.4.0 - Deep integration with RingKernel 0.4.2. Enterprise-ready with security, observability, resilience, and service APIs. -**Key dependency**: RustCompute (RingKernel) 0.3.1 - located at `../../RustCompute/RustCompute/` (relative path from workspace root). +**Key dependency**: RingKernel 0.4.2 (crates.io) - GPU-native persistent actor runtime with enterprise features. ## Build Commands @@ -159,12 +159,15 @@ Cross-kernel coordination in `rustkernel-core/src/k2k.rs`: ### Ring Message Type IDs -Each domain has a reserved range for Ring message type IDs: -- Graph: 200-299 +Each domain has a reserved range for Ring message type IDs, aligned with +`ringkernel_core::domain::Domain` base offsets (0.4.2): + +- Graph (GraphAnalytics): 100-199 +- ML (StatisticalML): 200-299 - Compliance: 300-399 -- Temporal: 400-499 -- Risk: 600-699 -- ML: 700-799 +- Risk (RiskManagement): 400-499 +- OrderMatching: 500-599 +- Temporal (TimeSeries): 1100-1199 ### Domain Crate Structure @@ -187,7 +190,7 @@ use rkyv::{Archive, Serialize, Deserialize}; #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 200)] // Unique within domain range +#[message(type_id = 100)] // Unique within domain range (GraphAnalytics: 100-199) pub struct MyRequest { #[message(id)] pub id: MessageId, @@ -195,7 +198,7 @@ pub struct MyRequest { } ``` -**Important**: `MessageId` is a tuple struct. Use `MessageId(value)` not `MessageId::new()`. +**Important**: `MessageId` supports both `MessageId(value)` and `MessageId::new(value)` (0.4.2+). For auto-generated IDs, use `MessageId::generate()`. ### Fixed-Point Arithmetic @@ -283,7 +286,63 @@ The following kernel categories were recently added: - `NextActivityPrediction` - Markov/N-gram next activity prediction - `EventLogImputation` - Event log quality detection and repair -## Enterprise Modules (0.3.1) +## RingKernel 0.4.2 Integration + +RustKernels 0.4.0 deeply integrates with RingKernel 0.4.2: + +### Domain Conversion + +Bidirectional conversion between `rustkernel_core::domain::Domain` and `ringkernel_core::domain::Domain`: + +```rust +use rustkernel_core::domain::Domain; + +let domain = Domain::TemporalAnalysis; +let ring_domain = domain.to_ring_domain(); // → ringkernel_core::domain::Domain::TimeSeries +let back = Domain::from_ring_domain(ring_domain); // → Domain::TemporalAnalysis + +// Naming differences: +// TemporalAnalysis ↔ TimeSeries +// RiskAnalytics ↔ RiskManagement +// Core ↔ General +``` + +### Direct RingKernel Access + +For advanced usage, the full ringkernel-core 0.4.2 API is available: + +```rust +use rustkernel_core::ring; // Full ringkernel_core re-export + +// New 0.4.2 types in prelude +use rustkernel_core::prelude::{Backend, KernelStatus, RuntimeMetrics, ControlBlock, K2KConfig, Priority}; + +// Enterprise re-exports from ringkernel-core in each module: +use rustkernel_core::security::ring_security; +use rustkernel_core::observability::ring_observability; +use rustkernel_core::resilience::ring_health; +use rustkernel_core::memory::ring_memory; +``` + +### New Re-exports + +Top-level re-exports from ringkernel-core 0.4.2: + +- `ControlBlock` - GPU control block for persistent kernel state +- `Backend` - Runtime backend selection (CUDA, CPU, WebGPU) +- `KernelStatus` - Detailed kernel status information +- `RuntimeMetrics` - Runtime performance metrics +- `K2KConfig` - Kernel-to-kernel messaging configuration +- `DeliveryStatus` - K2K message delivery tracking +- `Priority` - Message priority levels + +Submodule re-exports: +- `rustkernel_core::checkpoint` - Kernel checkpointing +- `rustkernel_core::dispatcher` - Message dispatching +- `rustkernel_core::health` - Health checking (circuit breaker, degradation) +- `rustkernel_core::pubsub` - Pub/sub messaging patterns + +## Enterprise Modules ### Security (`rustkernel-core/src/security/`) diff --git a/Cargo.lock b/Cargo.lock index e0a74ce..8593583 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2416,9 +2416,9 @@ dependencies = [ [[package]] name = "ringkernel" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b3b2fd1c291602f426eaf3183a9e5e016fe711237630e57c06fd74639a6a16" +checksum = "c6e500ad49feedb1036ddfe97d6b8e5bf72a3d3ed3e40a0043f6f685b67b3865" dependencies = [ "async-trait", "cfg-if", @@ -2435,9 +2435,9 @@ dependencies = [ [[package]] name = "ringkernel-codegen" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c3fe2271087fa3998c667d068f37a293e63634bfbe63ef34c9f722f575b7bef" +checksum = "1eb10618e9b845c677827911586e7b1a7792ce91d3933f35aa72303ddcb1de1e" dependencies = [ "handlebars", "proc-macro2", @@ -2450,9 +2450,9 @@ dependencies = [ [[package]] name = "ringkernel-core" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d22ebd86075991f4d540b6e6c0e1dec1c243e8f37e8fd043d8b2e6a64a60f4" +checksum = "e66a073c2c85bbf6dd2d67f67387c4888ec1786afed1ecfdeaf066a76c59f31d" dependencies = [ "async-trait", "atomic", @@ -2473,9 +2473,9 @@ dependencies = [ [[package]] name = "ringkernel-cpu" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44b8744707d1ffec29906a143921bfa932f1fdee222b8731c4a61e8488dbbecc" +checksum = "5907f80d92d3a089769c3a65c4ce1ff8c1804f9ff3c3cb773c4f1b3039730dcc" dependencies = [ "async-trait", "crossbeam", @@ -2492,9 +2492,9 @@ dependencies = [ [[package]] name = "ringkernel-derive" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ba6b072c640c543da8a3b209c915a311228f98d152313b886c2e7f36422f5a" +checksum = "8c01f3fd4ff1a05ccf4f789b9d065dd9258a14ea0d28095e5d719a13828a1134" dependencies = [ "darling", "proc-macro2", @@ -2546,7 +2546,7 @@ dependencies = [ [[package]] name = "rustkernel-accounting" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2560,7 +2560,7 @@ dependencies = [ [[package]] name = "rustkernel-audit" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2574,7 +2574,7 @@ dependencies = [ [[package]] name = "rustkernel-banking" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2588,7 +2588,7 @@ dependencies = [ [[package]] name = "rustkernel-behavioral" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2602,7 +2602,7 @@ dependencies = [ [[package]] name = "rustkernel-clearing" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2616,7 +2616,7 @@ dependencies = [ [[package]] name = "rustkernel-cli" -version = "0.2.0" +version = "0.4.0" dependencies = [ "anyhow", "clap", @@ -2630,7 +2630,7 @@ dependencies = [ [[package]] name = "rustkernel-compliance" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "rustkernel-core" -version = "0.2.0" +version = "0.4.0" dependencies = [ "actix", "anyhow", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "rustkernel-derive" -version = "0.2.0" +version = "0.4.0" dependencies = [ "darling", "proc-macro2", @@ -2704,7 +2704,7 @@ dependencies = [ [[package]] name = "rustkernel-ecosystem" -version = "0.2.0" +version = "0.4.0" dependencies = [ "actix", "actix-rt", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "rustkernel-graph" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2750,7 +2750,7 @@ dependencies = [ [[package]] name = "rustkernel-ml" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2772,7 +2772,7 @@ dependencies = [ [[package]] name = "rustkernel-orderbook" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "rustkernel-payments" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2803,7 +2803,7 @@ dependencies = [ [[package]] name = "rustkernel-procint" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "rand 0.9.2", @@ -2818,7 +2818,7 @@ dependencies = [ [[package]] name = "rustkernel-risk" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2835,7 +2835,7 @@ dependencies = [ [[package]] name = "rustkernel-temporal" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "inventory", @@ -2852,7 +2852,7 @@ dependencies = [ [[package]] name = "rustkernel-treasury" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "ringkernel-core", @@ -2866,7 +2866,7 @@ dependencies = [ [[package]] name = "rustkernels" -version = "0.2.0" +version = "0.4.0" dependencies = [ "async-trait", "criterion", diff --git a/Cargo.toml b/Cargo.toml index 63dbab6..ee0eb6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ members = [ ] [workspace.package] -version = "0.2.0" +version = "0.4.0" edition = "2024" rust-version = "1.85" authors = ["Michael Ivertowski"] @@ -33,38 +33,38 @@ keywords = ["gpu", "kernels", "cuda", "compute", "finance"] categories = ["science", "mathematics", "finance"] [workspace.dependencies] -# Internal crates (version required for crates.io publishing) -rustkernels = { version = "0.2.0", path = "crates/rustkernels" } -rustkernel-core = { version = "0.2.0", path = "crates/rustkernel-core" } -rustkernel-derive = { version = "0.2.0", path = "crates/rustkernel-derive" } -rustkernel-graph = { version = "0.2.0", path = "crates/rustkernel-graph" } -rustkernel-ml = { version = "0.2.0", path = "crates/rustkernel-ml" } -rustkernel-compliance = { version = "0.2.0", path = "crates/rustkernel-compliance" } -rustkernel-temporal = { version = "0.2.0", path = "crates/rustkernel-temporal" } -rustkernel-risk = { version = "0.2.0", path = "crates/rustkernel-risk" } -rustkernel-banking = { version = "0.2.0", path = "crates/rustkernel-banking" } -rustkernel-behavioral = { version = "0.2.0", path = "crates/rustkernel-behavioral" } -rustkernel-orderbook = { version = "0.2.0", path = "crates/rustkernel-orderbook" } -rustkernel-procint = { version = "0.2.0", path = "crates/rustkernel-procint" } -rustkernel-clearing = { version = "0.2.0", path = "crates/rustkernel-clearing" } -rustkernel-treasury = { version = "0.2.0", path = "crates/rustkernel-treasury" } -rustkernel-accounting = { version = "0.2.0", path = "crates/rustkernel-accounting" } -rustkernel-payments = { version = "0.2.0", path = "crates/rustkernel-payments" } -rustkernel-audit = { version = "0.2.0", path = "crates/rustkernel-audit" } - -# RustCompute / RingKernel dependencies (from crates.io) - 0.3.1 with enterprise features -ringkernel = "0.3.1" -ringkernel-core = "0.3.1" -ringkernel-derive = "0.3.1" -ringkernel-cuda = "0.3.1" # Primary GPU backend -ringkernel-cpu = "0.3.1" # CPU fallback backend -ringkernel-ecosystem = "0.3.1" -ringkernel-codegen = "0.3.1" -ringkernel-cuda-codegen = "0.3.1" # CUDA code generation - -# Deferred backends (uncomment when needed) -# ringkernel-wgpu = "0.3.1" -# ringkernel-metal = "0.3.1" +# Internal crates +rustkernels = { version = "0.4.0", path = "crates/rustkernels" } +rustkernel-core = { version = "0.4.0", path = "crates/rustkernel-core" } +rustkernel-derive = { version = "0.4.0", path = "crates/rustkernel-derive" } +rustkernel-graph = { version = "0.4.0", path = "crates/rustkernel-graph" } +rustkernel-ml = { version = "0.4.0", path = "crates/rustkernel-ml" } +rustkernel-compliance = { version = "0.4.0", path = "crates/rustkernel-compliance" } +rustkernel-temporal = { version = "0.4.0", path = "crates/rustkernel-temporal" } +rustkernel-risk = { version = "0.4.0", path = "crates/rustkernel-risk" } +rustkernel-banking = { version = "0.4.0", path = "crates/rustkernel-banking" } +rustkernel-behavioral = { version = "0.4.0", path = "crates/rustkernel-behavioral" } +rustkernel-orderbook = { version = "0.4.0", path = "crates/rustkernel-orderbook" } +rustkernel-procint = { version = "0.4.0", path = "crates/rustkernel-procint" } +rustkernel-clearing = { version = "0.4.0", path = "crates/rustkernel-clearing" } +rustkernel-treasury = { version = "0.4.0", path = "crates/rustkernel-treasury" } +rustkernel-accounting = { version = "0.4.0", path = "crates/rustkernel-accounting" } +rustkernel-payments = { version = "0.4.0", path = "crates/rustkernel-payments" } +rustkernel-audit = { version = "0.4.0", path = "crates/rustkernel-audit" } + +# RingKernel 0.4.2 - deep integration with enterprise features +ringkernel = "0.4.2" +ringkernel-core = "0.4.2" +ringkernel-derive = "0.4.2" +ringkernel-cuda = "0.4.2" # Primary GPU backend +ringkernel-cpu = "0.4.2" # CPU fallback backend +ringkernel-ecosystem = "0.4.2" +ringkernel-codegen = "0.4.2" +ringkernel-cuda-codegen = "0.4.2" # CUDA code generation + +# Additional backends (enable via features) +# ringkernel-wgpu = "0.4.2" +# ringkernel-metal = "0.4.2" # Async runtime tokio = { version = "1.48", features = ["full"] } diff --git a/crates/rustkernel-core/src/domain.rs b/crates/rustkernel-core/src/domain.rs index 5e9966a..b4f5901 100644 --- a/crates/rustkernel-core/src/domain.rs +++ b/crates/rustkernel-core/src/domain.rs @@ -15,7 +15,7 @@ use std::fmt; /// - Financial services (banking, compliance, risk, treasury) /// - Analytics (graph, ML, temporal, behavioral) /// - Operations (clearing, payments, order matching) -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum Domain { /// Graph analytics: centrality, community detection, motifs, similarity @@ -61,6 +61,7 @@ pub enum Domain { FinancialAudit, /// Core: test kernels and infrastructure validation + #[default] Core, } @@ -167,6 +168,32 @@ impl Domain { | Domain::RiskAnalytics ) } + + /// Convert to the corresponding `ringkernel_core::domain::Domain` variant. + /// + /// Mapping notes: + /// - `TemporalAnalysis` maps to `TimeSeries` + /// - `RiskAnalytics` maps to `RiskManagement` + /// - `Core` maps to `General` + /// - All other variants map by name. + #[must_use] + pub fn to_ring_domain(&self) -> ringkernel_core::domain::Domain { + ringkernel_core::domain::Domain::from(*self) + } + + /// Construct a `Domain` from a `ringkernel_core::domain::Domain` variant. + /// + /// Mapping notes: + /// - `TimeSeries` maps to `TemporalAnalysis` + /// - `RiskManagement` maps to `RiskAnalytics` + /// - `General` maps to `Core` + /// - Variants without a direct counterpart (`MarketData`, `Settlement`, + /// `NetworkAnalysis`, `FraudDetection`, `Simulation`, `Custom`) are + /// mapped to the closest match or `Core`. + #[must_use] + pub fn from_ring_domain(ring: ringkernel_core::domain::Domain) -> Self { + Domain::from(ring) + } } impl fmt::Display for Domain { @@ -175,6 +202,66 @@ impl fmt::Display for Domain { } } +// --------------------------------------------------------------------------- +// Bidirectional conversion: Domain <-> ringkernel_core::domain::Domain (0.4.2) +// --------------------------------------------------------------------------- + +impl From for ringkernel_core::domain::Domain { + fn from(d: Domain) -> Self { + use ringkernel_core::domain::Domain as RD; + match d { + Domain::GraphAnalytics => RD::GraphAnalytics, + Domain::StatisticalML => RD::StatisticalML, + Domain::Compliance => RD::Compliance, + Domain::TemporalAnalysis => RD::TimeSeries, + Domain::RiskAnalytics => RD::RiskManagement, + Domain::Banking => RD::Banking, + Domain::BehavioralAnalytics => RD::BehavioralAnalytics, + Domain::OrderMatching => RD::OrderMatching, + Domain::ProcessIntelligence => RD::ProcessIntelligence, + Domain::Clearing => RD::Clearing, + Domain::TreasuryManagement => RD::TreasuryManagement, + Domain::Accounting => RD::Accounting, + Domain::PaymentProcessing => RD::PaymentProcessing, + Domain::FinancialAudit => RD::FinancialAudit, + Domain::Core => RD::General, + } + } +} + +impl From for Domain { + fn from(rd: ringkernel_core::domain::Domain) -> Self { + use ringkernel_core::domain::Domain as RD; + match rd { + RD::General => Domain::Core, + RD::GraphAnalytics => Domain::GraphAnalytics, + RD::StatisticalML => Domain::StatisticalML, + RD::Compliance => Domain::Compliance, + RD::RiskManagement => Domain::RiskAnalytics, + RD::OrderMatching => Domain::OrderMatching, + RD::Accounting => Domain::Accounting, + RD::TimeSeries => Domain::TemporalAnalysis, + RD::Banking => Domain::Banking, + RD::BehavioralAnalytics => Domain::BehavioralAnalytics, + RD::ProcessIntelligence => Domain::ProcessIntelligence, + RD::Clearing => Domain::Clearing, + RD::TreasuryManagement => Domain::TreasuryManagement, + RD::PaymentProcessing => Domain::PaymentProcessing, + RD::FinancialAudit => Domain::FinancialAudit, + // Variants present in ringkernel_core but without a direct + // counterpart in this crate are mapped to the closest match. + RD::NetworkAnalysis => Domain::GraphAnalytics, + RD::FraudDetection => Domain::Banking, + RD::Settlement => Domain::Clearing, + RD::MarketData => Domain::Core, + RD::Simulation => Domain::Core, + RD::Custom => Domain::Core, + // Future-proofing: map unknown variants to Core. + _ => Domain::Core, + } + } +} + /// Feature strings for fine-grained licensing. /// /// Format: `Domain.Feature` (e.g., `GraphAnalytics.PageRank`) @@ -294,4 +381,84 @@ mod tests { assert_eq!(Domain::GraphAnalytics.to_string(), "GraphAnalytics"); assert_eq!(Domain::RiskAnalytics.to_string(), "RiskAnalytics"); } + + #[test] + fn test_domain_default() { + assert_eq!(Domain::default(), Domain::Core); + } + + #[test] + fn test_to_ring_domain_renamed_variants() { + use ringkernel_core::domain::Domain as RD; + + assert_eq!(Domain::TemporalAnalysis.to_ring_domain(), RD::TimeSeries); + assert_eq!(Domain::RiskAnalytics.to_ring_domain(), RD::RiskManagement); + assert_eq!(Domain::Core.to_ring_domain(), RD::General); + } + + #[test] + fn test_to_ring_domain_identity_variants() { + use ringkernel_core::domain::Domain as RD; + + assert_eq!(Domain::GraphAnalytics.to_ring_domain(), RD::GraphAnalytics); + assert_eq!(Domain::StatisticalML.to_ring_domain(), RD::StatisticalML); + assert_eq!(Domain::Compliance.to_ring_domain(), RD::Compliance); + assert_eq!(Domain::Banking.to_ring_domain(), RD::Banking); + assert_eq!( + Domain::BehavioralAnalytics.to_ring_domain(), + RD::BehavioralAnalytics + ); + assert_eq!(Domain::OrderMatching.to_ring_domain(), RD::OrderMatching); + assert_eq!( + Domain::ProcessIntelligence.to_ring_domain(), + RD::ProcessIntelligence + ); + assert_eq!(Domain::Clearing.to_ring_domain(), RD::Clearing); + assert_eq!( + Domain::TreasuryManagement.to_ring_domain(), + RD::TreasuryManagement + ); + assert_eq!(Domain::Accounting.to_ring_domain(), RD::Accounting); + assert_eq!( + Domain::PaymentProcessing.to_ring_domain(), + RD::PaymentProcessing + ); + assert_eq!(Domain::FinancialAudit.to_ring_domain(), RD::FinancialAudit); + } + + #[test] + fn test_from_ring_domain_renamed_variants() { + use ringkernel_core::domain::Domain as RD; + + assert_eq!(Domain::from_ring_domain(RD::TimeSeries), Domain::TemporalAnalysis); + assert_eq!(Domain::from_ring_domain(RD::RiskManagement), Domain::RiskAnalytics); + assert_eq!(Domain::from_ring_domain(RD::General), Domain::Core); + } + + #[test] + fn test_from_ring_domain_closest_match() { + use ringkernel_core::domain::Domain as RD; + + assert_eq!(Domain::from_ring_domain(RD::NetworkAnalysis), Domain::GraphAnalytics); + assert_eq!(Domain::from_ring_domain(RD::FraudDetection), Domain::Banking); + assert_eq!(Domain::from_ring_domain(RD::Settlement), Domain::Clearing); + assert_eq!(Domain::from_ring_domain(RD::MarketData), Domain::Core); + assert_eq!(Domain::from_ring_domain(RD::Simulation), Domain::Core); + assert_eq!(Domain::from_ring_domain(RD::Custom), Domain::Core); + } + + #[test] + fn test_ring_domain_roundtrip() { + // Every rustkernel Domain should survive a roundtrip through + // ringkernel_core and back. + for &domain in Domain::ALL { + let ring = domain.to_ring_domain(); + let back = Domain::from_ring_domain(ring); + assert_eq!( + back, domain, + "roundtrip failed for {:?} -> {:?} -> {:?}", + domain, ring, back + ); + } + } } diff --git a/crates/rustkernel-core/src/lib.rs b/crates/rustkernel-core/src/lib.rs index 6ba3c6e..0916699 100644 --- a/crates/rustkernel-core/src/lib.rs +++ b/crates/rustkernel-core/src/lib.rs @@ -9,8 +9,9 @@ //! - Kernel registry with auto-discovery //! - Licensing and feature gating system //! - Actix actor integration for GPU-backed actors -//! - Runtime lifecycle management (0.3.1) -//! - Enterprise security, observability, and resilience patterns (0.3.1) +//! - Runtime lifecycle management +//! - Enterprise security, observability, and resilience patterns +//! - Deep integration with ringkernel-core 0.4.2 (domain conversion, K2K, enterprise re-exports) #![warn(missing_docs)] #![warn(clippy::all)] @@ -27,7 +28,7 @@ pub mod slo; pub mod test_kernels; pub mod traits; -// Enterprise modules (0.3.1) +// Enterprise modules (with ringkernel-core 0.4.2 bridging) pub mod config; pub mod memory; pub mod observability; @@ -48,6 +49,25 @@ pub use ringkernel_core::runtime::{ KernelHandle, KernelId, KernelState, LaunchOptions, RingKernelRuntime, }; +// New re-exports from ringkernel-core 0.4.2 +pub use ringkernel_core::control::ControlBlock; +pub use ringkernel_core::k2k::{DeliveryStatus, K2KConfig}; +pub use ringkernel_core::message::{CorrelationId as RingCorrelationId, Priority}; +pub use ringkernel_core::runtime::{Backend, KernelStatus, RuntimeMetrics}; + +// Re-export ringkernel-core submodules for advanced consumers +pub use ringkernel_core::checkpoint; +pub use ringkernel_core::dispatcher; +pub use ringkernel_core::health; +pub use ringkernel_core::pubsub; + +/// Direct access to the full RingKernel 0.4.2 API. +/// +/// For advanced usage, you can access the complete ringkernel-core API through this module. +pub mod ring { + pub use ringkernel_core::*; +} + /// Prelude module for convenient imports pub mod prelude { pub use crate::domain::Domain; @@ -69,36 +89,42 @@ pub mod prelude { HealthStatus, IterativeKernel, KernelConfig, RingKernelHandler, SecureRingContext, }; - // Runtime lifecycle (0.3.1) + // Runtime lifecycle pub use crate::runtime::{ KernelRuntime, LifecycleState, RuntimeBuilder, RuntimeConfig, RuntimeHandle, RuntimePreset, RuntimeStats, }; - // Resilience patterns (0.3.1) + // Resilience patterns pub use crate::resilience::{ CircuitBreaker, CircuitBreakerConfig, CircuitState, DeadlineContext, HealthCheck, HealthCheckResult, HealthProbe, RecoveryPolicy, ResilienceConfig, RetryConfig, TimeoutConfig, }; - // Security (0.3.1) + // Security pub use crate::security::{ AuthConfig, KernelPermission, Permission, PermissionSet, Role, SecurityConfig, SecurityContext, TenantId, }; - // Memory management (0.3.1) + // Memory management pub use crate::memory::{ AnalyticsContext, AnalyticsContextManager, InterPhaseReduction, KernelMemoryManager, MemoryConfig, MemoryError, MemoryStats, PressureLevel, ReductionConfig, SyncMode, }; - // Production configuration (0.3.1) + // Production configuration pub use crate::config::{ProductionConfig, ProductionConfigBuilder}; // Re-exports from ringkernel-core pub use ringkernel_core::k2k::{K2KBroker, K2KEndpoint}; pub use ringkernel_core::runtime::{KernelHandle, KernelId, KernelState, LaunchOptions}; pub use ringkernel_core::{HlcTimestamp, MessageId, RingContext, RingMessage}; + + // New re-exports from ringkernel-core 0.4.2 + pub use ringkernel_core::control::ControlBlock; + pub use ringkernel_core::k2k::K2KConfig; + pub use ringkernel_core::message::Priority; + pub use ringkernel_core::runtime::{Backend, KernelStatus, RuntimeMetrics}; } diff --git a/crates/rustkernel-core/src/memory/mod.rs b/crates/rustkernel-core/src/memory/mod.rs index b6738b4..0f9e399 100644 --- a/crates/rustkernel-core/src/memory/mod.rs +++ b/crates/rustkernel-core/src/memory/mod.rs @@ -33,6 +33,11 @@ pub use reduction::{ ReductionConfig, ReductionError, ReductionOp, SyncMode, }; +// Re-export ringkernel-core 0.4.2 memory primitives for deep integration. +pub use ringkernel_core::analytics_context as ring_analytics_context; +pub use ringkernel_core::reduction as ring_reduction; +pub use ringkernel_core::memory as ring_memory; + use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::Arc; diff --git a/crates/rustkernel-core/src/observability/mod.rs b/crates/rustkernel-core/src/observability/mod.rs index 472f765..d4d355b 100644 --- a/crates/rustkernel-core/src/observability/mod.rs +++ b/crates/rustkernel-core/src/observability/mod.rs @@ -38,6 +38,13 @@ pub use logging::{LogConfig, LogLevel, StructuredLogger}; pub use metrics::{KernelMetrics, MetricsConfig, MetricsExporter}; pub use tracing::{KernelSpan, SpanContext, TracingConfig}; +// Re-export ringkernel-core 0.4.2 observability primitives for deep integration. +pub use ringkernel_core::observability as ring_observability; +pub use ringkernel_core::telemetry as ring_telemetry; +pub use ringkernel_core::telemetry_pipeline as ring_telemetry_pipeline; +pub use ringkernel_core::alerting as ring_alerting; +pub use ringkernel_core::logging as ring_logging; + use serde::{Deserialize, Serialize}; /// Unified observability configuration diff --git a/crates/rustkernel-core/src/resilience/mod.rs b/crates/rustkernel-core/src/resilience/mod.rs index 50847b0..8f1583d 100644 --- a/crates/rustkernel-core/src/resilience/mod.rs +++ b/crates/rustkernel-core/src/resilience/mod.rs @@ -34,6 +34,11 @@ pub use health::{HealthCheck, HealthCheckResult, HealthProbe}; pub use recovery::{RecoveryPolicy, RecoveryStrategy, RetryConfig}; pub use timeout::{DeadlineContext, TimeoutConfig, TimeoutError}; +// Re-export ringkernel-core 0.4.2 health/resilience primitives for deep integration. +pub use ringkernel_core::health as ring_health; +pub use ringkernel_core::timeout as ring_timeout; +pub use ringkernel_core::rate_limiting as ring_rate_limiting; + use serde::{Deserialize, Serialize}; use std::time::Duration; diff --git a/crates/rustkernel-core/src/runtime/mod.rs b/crates/rustkernel-core/src/runtime/mod.rs index 063cdeb..508b8d2 100644 --- a/crates/rustkernel-core/src/runtime/mod.rs +++ b/crates/rustkernel-core/src/runtime/mod.rs @@ -8,7 +8,7 @@ //! //! # Architecture //! -//! The runtime is built on ringkernel 0.3.1's `RingKernelRuntime` with additional +//! The runtime is built on ringkernel 0.4.2's `RingKernelRuntime` with additional //! enterprise features for production deployments: //! //! - **Lifecycle States**: `Created` → `Starting` → `Running` → `Draining` → `Stopped` diff --git a/crates/rustkernel-core/src/security/mod.rs b/crates/rustkernel-core/src/security/mod.rs index 458bc81..4518b6f 100644 --- a/crates/rustkernel-core/src/security/mod.rs +++ b/crates/rustkernel-core/src/security/mod.rs @@ -36,6 +36,14 @@ pub use rbac::{KernelPermission, Permission, PermissionSet, Role, RoleBinding}; pub use secrets::{SecretRef, SecretStore, SecretValue}; pub use tenancy::{ResourceQuota, Tenant, TenantConfig, TenantId}; +// Re-export ringkernel-core 0.4.2 security primitives for deep integration. +// These complement our higher-level security abstractions with low-level ring security. +pub use ringkernel_core::security as ring_security; +pub use ringkernel_core::auth as ring_auth; +pub use ringkernel_core::rbac as ring_rbac; +pub use ringkernel_core::secrets as ring_secrets; +pub use ringkernel_core::tenancy as ring_tenancy; + use serde::{Deserialize, Serialize}; use std::collections::HashSet; diff --git a/crates/rustkernel-derive/src/lib.rs b/crates/rustkernel-derive/src/lib.rs index 078244e..6c97ff5 100644 --- a/crates/rustkernel-derive/src/lib.rs +++ b/crates/rustkernel-derive/src/lib.rs @@ -3,6 +3,15 @@ //! This crate provides the following macros: //! - `#[gpu_kernel]` - Define a GPU kernel with metadata //! - `#[derive(KernelMessage)]` - Derive serialization for kernel messages +//! - `#[kernel_state]` - Mark types as GPU-compatible kernel state +//! +//! For low-level ring kernel macros, see `ringkernel-derive` 0.4.2 which provides: +//! - `#[derive(RingMessage)]` - Ring message serialization with domain-based type IDs +//! - `#[derive(PersistentMessage)]` - CUDA persistent message dispatch +//! - `#[derive(ControlBlockState)]` - Embedded state for GPU ControlBlocks +//! - `#[derive(GpuType)]` - Pod+Zeroable for GPU data transfer +//! - `#[ring_kernel]` - Ring kernel handler generation +//! - `#[stencil_kernel]` - CUDA stencil pattern kernels //! //! # Example //! diff --git a/crates/rustkernel-graph/src/ring_messages.rs b/crates/rustkernel-graph/src/ring_messages.rs index 0983469..756f2a6 100644 --- a/crates/rustkernel-graph/src/ring_messages.rs +++ b/crates/rustkernel-graph/src/ring_messages.rs @@ -1,27 +1,27 @@ //! Ring message types for Graph Analytics kernels. //! //! This module defines zero-copy Ring messages for GPU-native persistent actors. -//! Type IDs 200-299 are reserved for Graph Analytics domain. +//! Type IDs 100-199 are reserved for Graph Analytics domain. //! //! ## Type ID Allocation //! -//! - 200-209: PageRank messages -//! - 210-219: Community detection messages -//! - 220-229: Centrality messages -//! - 230-239: K2K coordination messages +//! - 100-109: PageRank messages +//! - 110-119: Community detection messages +//! - 120-129: Centrality messages +//! - 130-139: K2K coordination messages use ringkernel_derive::RingMessage; use rkyv::{Archive, Deserialize, Serialize}; use rustkernel_core::messages::MessageId; // ============================================================================ -// PageRank Ring Messages (200-209) +// PageRank Ring Messages (100-109) // ============================================================================ /// PageRank query request - get score for a specific node. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 200)] +#[message(type_id = 100)] pub struct PageRankQueryRing { /// Message ID. pub id: MessageId, @@ -32,7 +32,7 @@ pub struct PageRankQueryRing { /// PageRank query response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 201)] +#[message(type_id = 101)] pub struct PageRankQueryResponse { /// Original message ID. pub request_id: u64, @@ -49,7 +49,7 @@ pub struct PageRankQueryResponse { /// PageRank iterate request - perform one power iteration step. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 202)] +#[message(type_id = 102)] pub struct PageRankIterateRing { /// Message ID. pub id: MessageId, @@ -58,7 +58,7 @@ pub struct PageRankIterateRing { /// PageRank iterate response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 203)] +#[message(type_id = 103)] pub struct PageRankIterateResponse { /// Original message ID. pub request_id: u64, @@ -73,7 +73,7 @@ pub struct PageRankIterateResponse { /// PageRank converge request - iterate until threshold or max iterations. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 204)] +#[message(type_id = 104)] pub struct PageRankConvergeRing { /// Message ID. pub id: MessageId, @@ -86,7 +86,7 @@ pub struct PageRankConvergeRing { /// PageRank convergence response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 205)] +#[message(type_id = 105)] pub struct PageRankConvergeResponse { /// Original message ID. pub request_id: u64, @@ -99,7 +99,7 @@ pub struct PageRankConvergeResponse { } // ============================================================================ -// K2K Coordination Messages (230-239) +// K2K Coordination Messages (130-139) // ============================================================================ /// K2K iteration synchronization request. @@ -107,7 +107,7 @@ pub struct PageRankConvergeResponse { /// Used for coordinating distributed PageRank across graph partitions. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 230)] +#[message(type_id = 130)] pub struct K2KIterationSync { /// Message ID. pub id: MessageId, @@ -124,7 +124,7 @@ pub struct K2KIterationSync { /// K2K iteration sync response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 231)] +#[message(type_id = 131)] pub struct K2KIterationSyncResponse { /// Original message ID. pub request_id: u64, @@ -143,7 +143,7 @@ pub struct K2KIterationSyncResponse { /// When graph is partitioned, boundary nodes need score updates from other partitions. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 232)] +#[message(type_id = 132)] pub struct K2KBoundaryUpdate { /// Message ID. pub id: MessageId, @@ -164,7 +164,7 @@ pub struct K2KBoundaryUpdate { /// K2K boundary update acknowledgment. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 233)] +#[message(type_id = 133)] pub struct K2KBoundaryUpdateAck { /// Original message ID. pub request_id: u64, @@ -179,7 +179,7 @@ pub struct K2KBoundaryUpdateAck { /// Used to synchronize all workers before proceeding to next iteration. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 234)] +#[message(type_id = 134)] pub struct K2KBarrier { /// Message ID. pub id: MessageId, @@ -196,7 +196,7 @@ pub struct K2KBarrier { /// K2K barrier release. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 235)] +#[message(type_id = 135)] pub struct K2KBarrierRelease { /// Original barrier ID. pub barrier_id: u64, @@ -209,7 +209,7 @@ pub struct K2KBarrierRelease { /// K2K worker heartbeat. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 236)] +#[message(type_id = 136)] pub struct K2KHeartbeat { /// Message ID. pub id: MessageId, @@ -224,13 +224,13 @@ pub struct K2KHeartbeat { } // ============================================================================ -// Community Detection Ring Messages (210-219) +// Community Detection Ring Messages (110-119) // ============================================================================ /// Request to compute modularity for current community assignment. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 210)] +#[message(type_id = 110)] pub struct ComputeModularityRing { /// Message ID. pub id: MessageId, @@ -239,7 +239,7 @@ pub struct ComputeModularityRing { /// Modularity computation response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 211)] +#[message(type_id = 111)] pub struct ModularityResponse { /// Original message ID. pub request_id: u64, @@ -254,7 +254,7 @@ pub struct ModularityResponse { /// Used in distributed Louvain for proposing community merges across partitions. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 212)] +#[message(type_id = 112)] pub struct K2KCommunityMerge { /// Message ID. pub id: MessageId, diff --git a/crates/rustkernel-ml/src/ring_messages.rs b/crates/rustkernel-ml/src/ring_messages.rs index 1ddaa88..9e66e9f 100644 --- a/crates/rustkernel-ml/src/ring_messages.rs +++ b/crates/rustkernel-ml/src/ring_messages.rs @@ -1,27 +1,27 @@ //! Ring message types for Statistical ML kernels. //! //! This module defines zero-copy Ring messages for GPU-native persistent actors. -//! Type IDs 700-799 are reserved for Statistical ML domain. +//! Type IDs 200-299 are reserved for Statistical ML domain. //! //! ## Type ID Allocation //! -//! - 700-719: KMeans messages -//! - 720-739: DBSCAN messages -//! - 740-759: Anomaly detection messages -//! - 760-779: K2K parallel coordination messages +//! - 200-219: KMeans messages +//! - 220-239: DBSCAN messages +//! - 240-259: Anomaly detection messages +//! - 260-279: K2K parallel coordination messages use ringkernel_derive::RingMessage; use rkyv::{Archive, Deserialize, Serialize}; use rustkernel_core::messages::MessageId; // ============================================================================ -// KMeans Ring Messages (700-719) +// KMeans Ring Messages (200-219) // ============================================================================ /// Initialize KMeans with centroids. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 700)] +#[message(type_id = 200)] pub struct KMeansInitRing { /// Message ID. pub id: MessageId, @@ -36,7 +36,7 @@ pub struct KMeansInitRing { /// KMeans initialization response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 701)] +#[message(type_id = 201)] pub struct KMeansInitResponse { /// Original message ID. pub request_id: u64, @@ -49,7 +49,7 @@ pub struct KMeansInitResponse { /// Assign points to clusters (E-step). #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 702)] +#[message(type_id = 202)] pub struct KMeansAssignRing { /// Message ID. pub id: MessageId, @@ -60,7 +60,7 @@ pub struct KMeansAssignRing { /// Assignment response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 703)] +#[message(type_id = 203)] pub struct KMeansAssignResponse { /// Original message ID. pub request_id: u64, @@ -75,7 +75,7 @@ pub struct KMeansAssignResponse { /// Update centroids (M-step). #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 704)] +#[message(type_id = 204)] pub struct KMeansUpdateRing { /// Message ID. pub id: MessageId, @@ -86,7 +86,7 @@ pub struct KMeansUpdateRing { /// Update response with new centroids. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 705)] +#[message(type_id = 205)] pub struct KMeansUpdateResponse { /// Original message ID. pub request_id: u64, @@ -101,7 +101,7 @@ pub struct KMeansUpdateResponse { /// Query cluster assignment for a point. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 706)] +#[message(type_id = 206)] pub struct KMeansQueryRing { /// Message ID. pub id: MessageId, @@ -114,7 +114,7 @@ pub struct KMeansQueryRing { /// Query response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 707)] +#[message(type_id = 207)] pub struct KMeansQueryResponse { /// Original message ID. pub request_id: u64, @@ -125,7 +125,7 @@ pub struct KMeansQueryResponse { } // ============================================================================ -// K2K Parallel Centroid Update Messages (760-779) +// K2K Parallel Centroid Update Messages (260-279) // ============================================================================ /// K2K partial centroid update from a worker. @@ -134,7 +134,7 @@ pub struct KMeansQueryResponse { /// from its data partition. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 760)] +#[message(type_id = 260)] pub struct K2KPartialCentroid { /// Message ID. pub id: MessageId, @@ -155,7 +155,7 @@ pub struct K2KPartialCentroid { /// K2K centroid aggregation response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 761)] +#[message(type_id = 261)] pub struct K2KCentroidAggregation { /// Original request ID. pub request_id: u64, @@ -174,7 +174,7 @@ pub struct K2KCentroidAggregation { /// K2K iteration sync for distributed KMeans. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 762)] +#[message(type_id = 262)] pub struct K2KKMeansSync { /// Message ID. pub id: MessageId, @@ -193,7 +193,7 @@ pub struct K2KKMeansSync { /// K2K sync response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 763)] +#[message(type_id = 263)] pub struct K2KKMeansSyncResponse { /// Original request ID. pub request_id: u64, @@ -212,7 +212,7 @@ pub struct K2KKMeansSyncResponse { /// K2K broadcast new centroids to workers. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 764)] +#[message(type_id = 264)] pub struct K2KCentroidBroadcast { /// Message ID. pub id: MessageId, @@ -229,7 +229,7 @@ pub struct K2KCentroidBroadcast { /// K2K broadcast acknowledgment. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 765)] +#[message(type_id = 265)] pub struct K2KCentroidBroadcastAck { /// Original message ID. pub request_id: u64, diff --git a/crates/rustkernel-risk/src/ring_messages.rs b/crates/rustkernel-risk/src/ring_messages.rs index f27eb65..99eabba 100644 --- a/crates/rustkernel-risk/src/ring_messages.rs +++ b/crates/rustkernel-risk/src/ring_messages.rs @@ -1,27 +1,27 @@ //! Ring message types for Risk Analytics kernels. //! //! This module defines zero-copy Ring messages for GPU-native persistent actors. -//! Type IDs 600-699 are reserved for Risk Analytics domain. +//! Type IDs 400-499 are reserved for RiskManagement domain. //! //! ## Type ID Allocation //! -//! - 600-619: Monte Carlo VaR messages -//! - 620-639: Portfolio risk aggregation messages -//! - 640-659: Credit risk messages -//! - 660-679: K2K streaming coordination messages +//! - 400-419: Monte Carlo VaR messages +//! - 420-439: Portfolio risk aggregation messages +//! - 440-459: Credit risk messages +//! - 460-479: K2K streaming coordination messages use ringkernel_derive::RingMessage; use rkyv::{Archive, Deserialize, Serialize}; use rustkernel_core::messages::MessageId; // ============================================================================ -// Monte Carlo VaR Ring Messages (600-619) +// Monte Carlo VaR Ring Messages (400-419) // ============================================================================ /// Update position for streaming VaR calculation. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 600)] +#[message(type_id = 400)] pub struct UpdatePositionRing { /// Message ID. pub id: MessageId, @@ -38,7 +38,7 @@ pub struct UpdatePositionRing { /// Position update response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 601)] +#[message(type_id = 401)] pub struct UpdatePositionResponse { /// Original message ID. pub request_id: u64, @@ -51,7 +51,7 @@ pub struct UpdatePositionResponse { /// Query current VaR value. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 602)] +#[message(type_id = 402)] pub struct QueryVaRRing { /// Message ID. pub id: MessageId, @@ -64,7 +64,7 @@ pub struct QueryVaRRing { /// VaR query response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 603)] +#[message(type_id = 403)] pub struct QueryVaRResponse { /// Original message ID. pub request_id: u64, @@ -83,7 +83,7 @@ pub struct QueryVaRResponse { /// Trigger VaR recalculation. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 604)] +#[message(type_id = 404)] pub struct RecalculateVaRRing { /// Message ID. pub id: MessageId, @@ -98,7 +98,7 @@ pub struct RecalculateVaRRing { /// VaR recalculation response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 605)] +#[message(type_id = 405)] pub struct RecalculateVaRResponse { /// Original message ID. pub request_id: u64, @@ -113,7 +113,7 @@ pub struct RecalculateVaRResponse { } // ============================================================================ -// K2K Streaming Coordination Messages (660-679) +// K2K Streaming Coordination Messages (460-479) // ============================================================================ /// K2K position batch update for distributed VaR. @@ -121,7 +121,7 @@ pub struct RecalculateVaRResponse { /// Used when positions are partitioned across multiple workers. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 660)] +#[message(type_id = 460)] pub struct K2KPositionBatch { /// Message ID. pub id: MessageId, @@ -140,7 +140,7 @@ pub struct K2KPositionBatch { /// K2K partial VaR result from a worker. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 661)] +#[message(type_id = 461)] pub struct K2KPartialVaR { /// Message ID. pub id: MessageId, @@ -163,7 +163,7 @@ pub struct K2KPartialVaR { /// Sent to aggregator to combine partial VaR results. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 662)] +#[message(type_id = 462)] pub struct K2KVaRAggregation { /// Message ID. pub id: MessageId, @@ -180,7 +180,7 @@ pub struct K2KVaRAggregation { /// K2K VaR aggregation response. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 663)] +#[message(type_id = 463)] pub struct K2KVaRAggregationResponse { /// Original correlation ID. pub correlation_id: u64, @@ -199,7 +199,7 @@ pub struct K2KVaRAggregationResponse { /// Broadcasts market data updates to all VaR workers. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 664)] +#[message(type_id = 464)] pub struct K2KMarketUpdate { /// Message ID. pub id: MessageId, @@ -216,7 +216,7 @@ pub struct K2KMarketUpdate { /// K2K market update acknowledgment. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 665)] +#[message(type_id = 465)] pub struct K2KMarketUpdateAck { /// Original message ID. pub request_id: u64, @@ -231,7 +231,7 @@ pub struct K2KMarketUpdateAck { /// Sent when a position update causes VaR to breach limits. #[derive(Debug, Clone, Archive, Serialize, Deserialize, RingMessage)] #[archive(check_bytes)] -#[message(type_id = 666)] +#[message(type_id = 466)] pub struct K2KRiskLimitAlert { /// Message ID. pub id: MessageId, diff --git a/crates/rustkernel-temporal/src/ring_messages.rs b/crates/rustkernel-temporal/src/ring_messages.rs index 0a7b40d..7b54c85 100644 --- a/crates/rustkernel-temporal/src/ring_messages.rs +++ b/crates/rustkernel-temporal/src/ring_messages.rs @@ -1,29 +1,29 @@ -//! Ring message types for Temporal Analysis domain kernels. +//! Ring message types for TimeSeries domain kernels. //! //! These messages implement the `RingMessage` trait for GPU-native persistent //! actor communication in volatility analysis and temporal operations. //! -//! Type ID range: 400-499 (Temporal Analysis domain) +//! Type ID range: 1100-1199 (TimeSeries domain) //! //! ## Type ID Assignments -//! - 400-409: VolatilityAnalysis messages -//! - 410-419: Reserved for ARIMA -//! - 420-429: Reserved for ChangePointDetection -//! - 430-439: Reserved for SeasonalDecomposition +//! - 1100-1109: VolatilityAnalysis messages +//! - 1110-1119: Reserved for ARIMA +//! - 1120-1129: Reserved for ChangePointDetection +//! - 1130-1139: Reserved for SeasonalDecomposition use ringkernel_core::message::{CorrelationId, MessageId}; use ringkernel_derive::RingMessage; use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize}; // ============================================================================ -// Volatility Analysis Ring Messages (400-409) +// Volatility Analysis Ring Messages (1100-1109) // ============================================================================ /// Ring message for updating volatility model with new return data. /// -/// Type ID: 400 +/// Type ID: 1100 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 400)] +#[message(type_id = 1100)] #[archive(check_bytes)] pub struct UpdateVolatilityRing { /// Message ID. @@ -60,9 +60,9 @@ impl UpdateVolatilityRing { /// Response from volatility update. /// -/// Type ID: 401 +/// Type ID: 1101 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 401)] +#[message(type_id = 1101)] #[archive(check_bytes)] pub struct UpdateVolatilityResponse { /// Correlation ID. @@ -92,9 +92,9 @@ impl UpdateVolatilityResponse { /// Ring message for querying current volatility forecast. /// -/// Type ID: 402 +/// Type ID: 1102 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 402)] +#[message(type_id = 1102)] #[archive(check_bytes)] pub struct QueryVolatilityRing { /// Message ID. @@ -123,9 +123,9 @@ impl QueryVolatilityRing { /// Response with volatility forecast. /// -/// Type ID: 403 +/// Type ID: 1103 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 403)] +#[message(type_id = 1103)] #[archive(check_bytes)] pub struct QueryVolatilityResponse { /// Correlation ID. @@ -155,9 +155,9 @@ impl QueryVolatilityResponse { /// Volatility spike alert. /// -/// Type ID: 404 +/// Type ID: 1104 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 404)] +#[message(type_id = 1104)] #[archive(check_bytes)] pub struct VolatilitySpikeAlert { /// Message ID. @@ -183,9 +183,9 @@ pub struct VolatilitySpikeAlert { /// Ring message for EWMA volatility update. /// -/// Type ID: 405 +/// Type ID: 1105 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 405)] +#[message(type_id = 1105)] #[archive(check_bytes)] pub struct UpdateEWMAVolatilityRing { /// Message ID. @@ -238,9 +238,9 @@ impl UpdateEWMAVolatilityRing { /// Response from EWMA update. /// -/// Type ID: 406 +/// Type ID: 1106 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 406)] +#[message(type_id = 1106)] #[archive(check_bytes)] pub struct UpdateEWMAVolatilityResponse { /// Correlation ID. @@ -260,9 +260,9 @@ pub struct UpdateEWMAVolatilityResponse { /// Ring message to set GARCH coefficients. /// -/// Type ID: 407 +/// Type ID: 1107 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 407)] +#[message(type_id = 1107)] #[archive(check_bytes)] pub struct SetGARCHCoefficientsRing { /// Message ID. @@ -297,9 +297,9 @@ impl SetGARCHCoefficientsRing { /// Response from setting coefficients. /// -/// Type ID: 408 +/// Type ID: 1108 #[derive(Debug, Clone, Archive, RkyvSerialize, RkyvDeserialize, RingMessage)] -#[message(type_id = 408)] +#[message(type_id = 1108)] #[archive(check_bytes)] pub struct SetGARCHCoefficientsResponse { /// Correlation ID.