Skip to main content

CommonLibrary/Transport/
mod.rs

1#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
2//! # Transport Layer
3//!
4//! This module defines the transport-layer abstraction that enables
5//! communication between CodeEditorLand components through various mechanisms
6//! (gRPC, IPC, WASM) using a unified Strategy pattern interface.
7//!
8//! ## Architecture
9//!
10//! - [`TransportStrategy`] - Core trait all transports must implement
11//! - [`Registry::TransportRegistry`] - Dynamic transport selection and
12//!   management
13//! - [`UnifiedRequest`] / [`UnifiedResponse`] - Common message format
14//! - [`TransportError`] - Unified error taxonomy
15//! - [`TransportConfig`] - Configuration structures
16//!
17//! ## Sub-modules
18//!
19//! - [`Common`] - Shared types and utilities
20//! - [`gRPC`] - gRPC transport implementation
21//! - [`IPC`] - IPC (Unix sockets/Named pipes) implementation
22//! - [`WASM`] - WebAssembly/WebWorker implementation
23//! - [`Registry`] - Transport registry and selection
24//! - [`Metrics`] - Metrics collection and monitoring
25//! - [`Retry`] - Retry strategies with backoff
26//! - [`CircuitBreaker`] - Circuit breaker pattern
27//! - [`DTO`] - Data Transfer Objects
28//!
29//! ## Usage
30//!
31//! Components should use the transport abstraction to remain
32//! transport-agnostic:
33//!
34//! ```rust
35//! use common_common::transport::{TransportStrategy, UnifiedRequest};
36//!
37//! async fn send_request(
38//! 	transport:&mut dyn TransportStrategy,
39//! 	method:&str,
40//! 	payload:Vec<u8>,
41//! ) -> Result<Vec<u8>, TransportError> {
42//! 	let request = UnifiedRequest::new(method, payload);
43//! 	let response = transport.send_request(request).await?;
44//! 	Ok(response.payload)
45//! }
46//! ```
47
48// --- Core Trait and Types ---
49pub mod TransportStrategy;
50pub mod TransportError;
51pub mod UnifiedRequest;
52pub mod UnifiedResponse;
53pub mod TransportConfig;
54
55// --- Transport Implementations (proper acronym casing: gRPC, IPC, WASM) ---
56pub mod gRPC;
57pub mod IPC;
58pub mod WASM;
59
60// --- Infrastructure ---
61pub mod Registry;
62pub mod Metrics;
63pub mod Retry;
64pub mod CircuitBreaker;
65pub mod Common;
66
67// --- Data Transfer Objects ---
68pub mod DTO;