Expand description
Hardware Report Library
This library provides hardware information collection capabilities using a Ports and Adapters (Hexagonal) architecture for maintainability and testability.
§Architecture
- Domain: Core business logic and entities
- Ports: Interfaces for external interactions
- Adapters: Platform-specific implementations
§Usage
§As a Library
use hardware_report::{HardwareReportingService, ReportConfig};
async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Create service with platform-specific adapters
let service = hardware_report::create_service(None).await?;
// Generate hardware report
let config = ReportConfig::default();
let report = service.generate_report(config).await?;
println!("System: {} ({})", report.hostname, report.summary.system_info.product_name);
Ok(())
}§Legacy Compatibility
The library maintains backward compatibility with the original ServerInfo API:
use hardware_report::ServerInfo;
fn legacy_example() -> Result<(), Box<dyn std::error::Error>> {
let server_info = ServerInfo::collect()?;
println!("Hostname: {}", server_info.hostname);
Ok(())
}Re-exports§
pub use adapters::FileDataPublisher;pub use adapters::FileSystemRepository;pub use adapters::HttpDataPublisher;pub use adapters::LinuxSystemInfoProvider;pub use adapters::MacOSSystemInfoProvider;pub use adapters::UnixCommandExecutor;pub use container::ContainerConfig;pub use container::ContainerConfigBuilder;pub use container::ServiceContainer;pub use domain::PublishConfig;pub use domain::PublishError;pub use domain::ReportConfig;pub use domain::ReportError;pub use ports::CommandExecutor;pub use ports::ConfigurationProvider;pub use ports::DataPublisher;pub use ports::FileRepository;pub use ports::HardwareReportingService;pub use ports::OutputFormat;pub use ports::SystemInfoProvider;pub use domain::HardwareReport as NewHardwareReport;
Modules§
- adapters
- container
- Dependency injection container for hardware reporting services
- domain
- new_
domain - ports
- posting
Structs§
- Bios
Info - BIOS information
- Chassis
Info - Chassis information
- CpuInfo
- Represents CPU information.
- CpuTopology
- CPU topology information
- GpuDevice
- Represents a GPU device.
- GpuInfo
- Represents GPU information.
- Hardware
Info - Contains detailed hardware information
- IbInterface
- Represents an Infiniband interface.
- Infiniband
Info - Represents Infiniband information.
- InterfaceI
Ps - Memory
Info - Represents memory information.
- Memory
Module - Represents a memory module.
- Motherboard
Info - Motherboard information
- Network
Info - Represents network information.
- Network
Interface - Represents a network interface.
- Numa
Device - Represents a device attached to a NUMA node
- Numa
Info - Numa
Node - Represents a NUMA node
- Server
Info - Represents the overall server information
- Storage
Device - Represents a storage device.
- Storage
Info - Represents storage information.
- System
Info - System
Summary - Summary of key system components
Functions§
- create_
service - Create a hardware reporting service with platform-appropriate adapters
- create_
service_ with_ config - Create a hardware reporting service with custom container configuration
- validate_
system - Validate system dependencies and privileges