Skip to main content

Crate product_os_command_control

Crate product_os_command_control 

Source
Expand description

§Product OS Command and Control

This crate 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.

§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

§Basic Usage

use product_os_command_control::ProductOSController;
use product_os_command_control::CommandControl;
use product_os_security::certificates::Certificates;

let config = CommandControl::default();
let certs = Certificates::new_self_signed(
    vec![("CN".to_string(), "localhost".to_string())],
    None, None, None, None, None,
);

let controller = ProductOSController::new(
    config,
    certs,
    None, // Optional key-value store
    #[cfg(feature = "relational_store")]
    None, // Optional relational store
);

let registry = controller.get_registry();
let my_node = registry.get_me();
println!("Node ID: {}", my_node.get_identifier());

§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

§Cargo Features

FeatureDefaultDescription
std_baseYesStd support with core Product OS dependencies
framework_axumYesAxum HTTP framework
framework_flowNoFlow HTTP framework
monitorYesMonitoring via product-os-monitoring
tokioNoTokio async executor
distributedNoDistributed node discovery (placeholder)
relational_storeNoBase relational store support
postgres_storeNoPostgreSQL relational store
sqlite_storeNoSQLite relational store
redis_key_value_storeNoRedis key-value store
memory_key_value_storeNoIn-memory key-value store
file_key_value_storeNoFile-based key-value store
redis_queue_storeNoRedis queue store
memory_queue_storeNoIn-memory queue store

Modules§

authentication
Authentication module
commands
Command execution module

Structs§

CommandControl
Command and control configuration for managing distributed services.
Node
Represents a single server instance (node) in the Product OS cluster.
ProductOSController
Main controller for managing a distributed command and control system.

Enums§

Method
HTTP request method enumeration

Functions§

pulse_run
Runs a single pulse check cycle, verifying node health and connectivity.
run_controller
Runs the controller lifecycle: self-trust, discovery, announcements, and periodic tasks.