Expand description
§Hierarchical Command Coordination
This module implements bidirectional command dissemination with policy-based flexibility.
§Overview
Complements upward capability aggregation with downward command propagation:
- Policy-based routing: Commands carry routing policies (buffer, conflict, acknowledgment)
- Hierarchical dissemination: Commands flow down through Zone → Cell → Node hierarchy
- Acknowledgment tracking: Optional acknowledgment based on command policy
- Conflict resolution: Deterministic resolution when multiple commands target same resource
§Architecture
┌──────────────────────────────────────────────────┐
│ Zone Commander (Higher Echelon) │
│ Issues HierarchicalCommand with policies │
└────────────────────┬─────────────────────────────┘
│
┌──────────┴──────────┐
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Cell 1 │ │ Cell 2 │
│ Receives │ │ Receives │
│ & Routes │ │ & Routes │
└──────┬──────┘ └──────┬──────┘
│ │
┌────┴────┐ ┌────┴────┐
▼ ▼ ▼ ▼
Node-1 Node-2 Node-3 Node-4
(Execute & Ack) (Execute & Ack)§Usage
ⓘ
use peat_protocol::command::CommandCoordinator;
use peat_schema::command::v1::HierarchicalCommand;
// Create coordinator for a squad leader
let coordinator = CommandCoordinator::new(
Some("squad-alpha".to_string()),
"node-1".to_string(),
vec!["node-1".to_string(), "node-2".to_string()], // squad members
);
// Issue a command to squad members
let command = HierarchicalCommand {
command_id: "cmd-001".to_string(),
originator_id: "node-1".to_string(),
// ... command details
..Default::default()
};
coordinator.issue_command(command).await?;§Related ADRs
- ADR-014: Distributed Coordination Primitives
- ADR-013: AI Operations and Binary Transfer
- ADR-009: Bidirectional Hierarchical Flows
Structs§
- AckTimeout
- Acknowledgment timeout tracking
- Command
Coordinator - Coordinates hierarchical command dissemination
- Command
Router - Resolves command targets to specific node IDs
- Conflict
Resolver - Conflict resolution engine
- Observer
Handle - Handle for an active observer subscription
- Timeout
Manager - Timeout manager for commands and acknowledgments
Enums§
- Conflict
Result - Result of conflict detection
- Target
Resolution - Result of target resolution
Traits§
- Command
Storage - Backend-agnostic storage interface for hierarchical commands