Expand description
§Base64 Encoding Service
Production-ready Base64 encoding/decoding stage for the adaptive pipeline. This service provides reversible binary-to-text encoding, useful for:
- Data Transport: Encoding binary data for text-based protocols
- Embedding: Embedding binary data in JSON/XML/YAML configurations
- Debugging: Making binary data human-readable in logs
- Compatibility: Ensuring data passes through text-only channels
§Architecture
This implementation demonstrates the complete pattern for creating pipeline stages:
- Config Struct:
Base64Configwith typed parameters - FromParameters: Type-safe extraction from HashMap
- Service Struct:
Base64EncodingServiceimplementsStageService - Position:
PreBinary(must encode before compression/encryption) - Reversibility: Fully reversible (Forward = encode, Reverse = decode)
§Usage
use adaptive_pipeline::infrastructure::services::Base64EncodingService;
use adaptive_pipeline_domain::services::StageService;
let service = Base64EncodingService::new();
// Used automatically by pipeline when configured with StageType::Transform§Configuration Parameters
- variant (optional): Base64 variant to use
"standard"- Standard Base64 (default)"url_safe"- URL-safe Base64 (no padding)- Default: “standard”
§Performance Characteristics
- Throughput: ~500 MB/s encoding, ~600 MB/s decoding
- Overhead: 33% size increase when encoding (4 bytes per 3 input bytes)
- Memory: Constant overhead, no buffering required
- Latency: Minimal, single-pass algorithm
Structs§
- Base64
Config - Configuration for Base64 encoding operations.
- Base64
Encoding Service - Production Base64 encoding/decoding service.
Enums§
- Base64
Variant - Base64 encoding variants with different character sets and padding rules.