23 releases
| 0.0.27 | Feb 9, 2026 |
|---|---|
| 0.0.25 | Jun 30, 2025 |
| 0.0.24 | May 17, 2025 |
| 0.0.21 | Jan 11, 2025 |
| 0.0.6 | Oct 21, 2023 |
#239 in Concurrency
Used in 4 crates
1.5MB
21K
SLoC
Product OS : Command and Control
Product OS : Command and Control provides a distributed command and control system for coordinating multiple Product OS server instances. It enables secure communication, service discovery, and workload distribution across a cluster of nodes.
What is Product OS?
Product OS is a collection of packages that provide different tools and features that can work together to build products more easily for the Rust ecosystem.
Features
- Secure Communication: Authentication framework using Diffie-Hellman key exchange
- Service Discovery: Automatic node registration and discovery
- Load Balancing: Smart routing to available nodes based on capabilities
- Health Monitoring: Pulse checks and automatic failure detection
- Feature Management: Dynamic feature and service registration
- No-std Support: Works in
no_stdenvironments with alloc
Installation
Add Product OS : Command and Control to your Cargo.toml:
[dependencies]
product-os-command-control = { version = "0.0.25" }
Quick Start
use product_os_command_control::ProductOSController;
use product_os_configuration::Configuration;
use product_os_security::certificates::Certificates;
async fn example() {
// Create configuration and certificates
let config = Configuration::new();
let certs = Certificates::new_self_signed(
vec![("CN".to_string(), "localhost".to_string())],
None, None, None, None, None,
);
// Initialize the controller
let controller = ProductOSController::new(
config,
certs,
None, // Optional key-value store
);
// Access the registry
let registry = controller.get_registry();
let my_node = registry.get_me();
println!("Node ID: {}", my_node.get_identifier());
}
Feature Flags
default: Standard library support with monitoringmonitor: Enable monitoring servicetokio: Enable Tokio async executordistributed: Enable distributed node discovery and communicationpostgres_store: PostgreSQL relational store supportsqlite_store: SQLite relational store supportredis_key_value_store: Redis key-value store supportmemory_key_value_store: In-memory key-value store supportfile_key_value_store: File-based key-value store supportredis_queue_store: Redis queue store supportmemory_queue_store: In-memory queue store support
Architecture
The command and control system consists of several key components:
- ProductOSController: Main coordinator that manages nodes and services
- Registry: Tracks available nodes and their capabilities
- Node: Represents a single server instance in the cluster
- Commands: Structured way to send instructions to remote nodes
Security
All node-to-node communication is secured using:
- TLS/SSL certificates for transport security
- Diffie-Hellman key exchange for establishing shared secrets
- Message authentication using HMAC
Service Management
use product_os_command_control::ProductOSController;
use std::sync::Arc;
async fn manage_services(controller: &mut ProductOSController) {
// Add a service
let service = /* ... */;
controller.add_service(service).await;
// Start all services
controller.start_services().await;
// Start a specific service
controller.start_service("my-service").await;
// Stop a service
controller.stop_service("my-service").await;
}
Node Discovery
use product_os_command_control::ProductOSController;
async fn discover(controller: &mut ProductOSController) {
// Discover other nodes in the cluster
controller.discover_nodes().await;
// Get the registry with all known nodes
let registry = controller.get_registry();
}
Testing
# Run all tests
cargo test --all-features
# Run with specific features
cargo test --features "monitor,tokio"
# Generate documentation
cargo doc --all-features --open
License
Contributing
Contributions are welcome! Please ensure:
- All tests pass:
cargo test --all-features - Code is formatted:
cargo fmt - No clippy warnings:
cargo clippy --all-features - Documentation is updated for public APIs
Minimum Supported Rust Version (MSRV)
Rust 1.69 or later.
Dependencies
~29–53MB
~851K SLoC