Module base64_encoding

Module base64_encoding 

Source
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: Base64Config with typed parameters
  • FromParameters: Type-safe extraction from HashMap
  • Service Struct: Base64EncodingService implements StageService
  • 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§

Base64Config
Configuration for Base64 encoding operations.
Base64EncodingService
Production Base64 encoding/decoding service.

Enums§

Base64Variant
Base64 encoding variants with different character sets and padding rules.