RustFS Utils - Utility Library
๐ Overview
RustFS Utils is the utility library for the RustFS distributed object storage system. It provides a comprehensive collection of utility functions, helper tools, and common functionality used across all RustFS modules, including system operations, cryptographic utilities, compression, and cross-platform compatibility tools.
Note: This is a foundational submodule of RustFS that provides essential utility functions for the distributed object storage system. For the complete RustFS experience, please visit the main RustFS repository.
โจ Features
๐ง System Utilities
- Cross-Platform Operations: Unified system operations across platforms
- Process Management: Process spawning and management utilities
- Resource Monitoring: CPU, memory, and disk usage monitoring
- Network Utilities: Network interface and connectivity tools
๐ File System Utilities
- Path Manipulation: Advanced path handling and normalization
- File Operations: Safe file operations with atomic writes
- Directory Management: Recursive directory operations
- Symbolic Link Handling: Cross-platform symlink management
๐๏ธ Compression & Encoding
- Multiple Algorithms: Support for gzip, zstd, lz4, and more
- Streaming Compression: Memory-efficient streaming compression
- Base64 Encoding: High-performance base64 operations
- URL Encoding: Safe URL encoding and decoding
๐ Cryptographic Utilities
- Hash Functions: MD5, SHA1, SHA256, XXHash implementations
- Random Generation: Cryptographically secure random utilities
- Certificate Handling: X.509 certificate parsing and validation
- Key Generation: Secure key generation utilities
๐ Network Utilities
- HTTP Helpers: HTTP client and server utilities
- DNS Resolution: DNS lookup and resolution tools
- Network Interface: Interface detection and configuration
- Protocol Utilities: Various network protocol helpers
๐ฆ Installation
Add this to your Cargo.toml
:
[]
= "0.0.3"
# Or with specific features
= { = "0.0.3", = ["compression", "crypto", "network"] }
Feature Flags
[]
= { = "0.0.3", = ["full"] }
Available features:
compression
- Compression and decompression utilitiescrypto
- Cryptographic functions and utilitiesnetwork
- Network-related utilitiespath
- Advanced path manipulation toolssystem
- System monitoring and managementfull
- All features enabled
๐ง Usage
File System Utilities
use ;
use ;
Compression Utilities
use ;
Cryptographic Utilities
use ;
use HashAlgorithm;
System Monitoring
use ;
async
Network Utilities
use ;
async
Certificate Utilities
use ;
Encoding Utilities
use ;
๐๏ธ Architecture
Utils Module Structure
Utils Architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Public API Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ File System โ Compression โ Crypto โ Network โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ System Info โ Encoding โ Certs โ Path Utils โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Platform Abstraction Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Operating System Integration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Feature Overview
Category | Features | Platform Support |
---|---|---|
File System | Atomic operations, path manipulation | All platforms |
Compression | Gzip, Zstd, LZ4, Brotli | All platforms |
Cryptography | Hashing, random generation, keys | All platforms |
System | Resource monitoring, process management | Linux, macOS, Windows |
Network | DNS, connectivity, interface detection | All platforms |
๐งช Testing
Run the test suite:
# Run all tests
# Run tests for specific features
# Run tests with all features
# Run benchmarks
๐ Performance
The utils library is optimized for performance:
- Zero-Copy Operations: Minimize memory allocations where possible
- Lazy Evaluation: Defer expensive operations until needed
- Platform Optimization: Use platform-specific optimizations
- Efficient Algorithms: Choose the most efficient algorithms for each task
Benchmarks
Operation | Performance | Notes |
---|---|---|
Path Normalization | ~50 ns | Uses efficient string operations |
Base64 Encoding | ~1.2 GB/s | SIMD-optimized implementation |
XXHash64 | ~15 GB/s | Hardware-accelerated when available |
File Copy | ~2 GB/s | Platform-optimized copy operations |
๐ Requirements
- Rust: 1.70.0 or later
- Platforms: Linux, macOS, Windows
- Architecture: x86_64, aarch64, and others
- Dependencies: Minimal external dependencies
๐ Related Projects
This module is part of the RustFS ecosystem:
- RustFS Main - Core distributed storage system
- RustFS ECStore - Erasure coding storage engine
- RustFS Crypto - Cryptographic operations
- RustFS Config - Configuration management
๐ Documentation
For comprehensive documentation, visit:
๐ Links
- Documentation - Complete RustFS manual
- Changelog - Release notes and updates
- GitHub Discussions - Community support
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
๐ License
Licensed under the Apache License, Version 2.0. See LICENSE for details.