Module platform

Module platform 

Source
Expand description

§Platform Abstraction Module

This module provides platform-specific abstractions for operating system functionality, following the pattern used in the Ada project.

§Architecture Pattern

Following hexagonal architecture principles:

  • Interface: Platform trait defines the contract
  • Implementations:
    • UnixPlatform: POSIX implementation (Linux + macOS)
    • WindowsPlatform: Windows API implementation
  • Selection: Compile-time platform selection via #[cfg]

§Design Philosophy

The bootstrap module sits OUTSIDE the enterprise application layers, so it can access platform-specific APIs directly. This abstraction:

  1. Isolates OS-specific code to one module
  2. Enables testing via trait mocking
  3. Provides consistent API across platforms
  4. Avoids scattered conditional compilation

§Usage

use adaptive_pipeline_bootstrap::platform::create_platform;

let platform = create_platform();
println!("Running on: {}", platform.platform_name());
println!("CPU cores: {}", platform.cpu_count());

Structs§

UnixPlatform
Unix (POSIX) platform implementation

Enums§

PlatformError
Platform-specific errors

Traits§

Platform
Platform abstraction trait for OS-specific operations

Functions§

create_platform
Create the platform-specific implementation