adaptive_pipeline/infrastructure/
adapters.rs

1// /////////////////////////////////////////////////////////////////////////////
2// Adaptive Pipeline
3// Copyright (c) 2025 Michael Gardner, A Bit of Help, Inc.
4// SPDX-License-Identifier: BSD-3-Clause
5// See LICENSE file in the project root.
6// /////////////////////////////////////////////////////////////////////////////
7
8//! # Infrastructure Adapters Module
9//!
10//! This module contains concrete implementations of domain interfaces (ports),
11//! following the Hexagonal Architecture pattern. These adapters handle:
12//!
13//! - External service integrations
14//! - File I/O operations
15//! - Compression algorithms
16//! - Encryption services
17//! - Data transformation
18//!
19//! ## Design Principles
20//!
21//! 1. **Dependency Inversion**: Adapters depend on domain interfaces, not vice
22//!    versa
23//! 2. **Single Responsibility**: Each adapter has one clear purpose
24//! 3. **Testability**: Adapters can be easily mocked or replaced
25//! 4. **Configuration**: Adapters are configured through dependency injection
26//!
27//! ## Module Structure
28//!
29//! ```text
30//! adapters/
31//! ├── chunk_processor_adapters.rs  # Chunk processing implementations
32//! ├── compression.rs               # Compression service implementations
33//! ├── encryption.rs                # Encryption service implementations
34//! ├── file_io.rs                   # File I/O service implementations
35//! ├── async_compression.rs         # Async compression adapter
36//! ├── async_encryption.rs          # Async encryption adapter
37//! └── async_checksum.rs            # Async checksum adapter
38//!     requires_security_context: false,
39//! };
40//!
41//! // Create adapter
42//! let adapter = ServiceChunkAdapter::new(
43//!     service,
44//!     "my_service".to_string(),
45//!     config
46//! );
47//! ```
48//!
49//! ## Architecture Benefits
50//!
51//! - **Separation of Concerns**: Services focus on business logic, adapters
52//!   handle integration
53//! - **Reusability**: Services can be used in multiple contexts through
54//!   different adapters
55//! - **Testability**: Easy to test services independently of their usage
56//!   context
57//! - **Flexibility**: Runtime configuration of adapter behavior
58
59/// Chunk processor adapters for service integration
60pub mod chunk_processor_adapters;
61
62/// Compression service adapter
63pub mod compression;
64
65/// Async compression adapter (wraps sync domain trait for async contexts)
66pub mod async_compression;
67
68/// Async encryption adapter (wraps sync domain trait for async contexts)
69pub mod async_encryption;
70
71/// Async checksum adapter (wraps sync domain trait for async contexts)
72pub mod async_checksum;
73
74/// Encryption service adapter
75pub mod encryption;
76
77/// File I/O service adapter
78pub mod file_io;
79
80// Re-export for easy access
81pub use async_checksum::*;
82pub use async_compression::*;
83pub use async_encryption::*;
84pub use compression::*;
85pub use encryption::*;