1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Service Discovery
//!
//! Provides automatic node registration and discovery capabilities.
//! Nodes can register themselves, discover other nodes, and find publishers/subscribers
//! for specific topics.
//!
//! # Architecture
//!
//! - Uses Redis as the registry backend
//! - Nodes register with TTL (time-to-live) and heartbeat
//! - Automatic registration on Context creation
//! - Automatic unregistration on shutdown
//! - Query by node type, topic, or capability
//!
//! # Example
//!
//! ```rust
//! use mecha10_core::prelude::*;
//! use mecha10_core::discovery::{DiscoveryExt, NodeMetadata};
//!
//! # async fn example() -> Result<()> {
//! let ctx = Context::new("my-node").await?;
//!
//! // Register with metadata (auto-registers on Context::new)
//! ctx.register(NodeMetadata {
//! node_type: "perception".to_string(),
//! publishes: vec!["/perception/detections".to_string()],
//! subscribes: vec!["/sensors/camera/rgb".to_string()],
//! capabilities: vec!["object_detection".to_string()],
//! ..Default::default()
//! }).await?;
//!
//! // Discover nodes by type
//! let cameras = ctx.discover_by_type("camera_driver").await?;
//! for node in cameras {
//! println!("Found camera: {} at {:?}", node.node_id, node.publishes);
//! }
//!
//! // Find who publishes a topic
//! let publishers = ctx.discover_publishers("/sensors/lidar").await?;
//!
//! # Ok(())
//! # }
//! ```
pub use ;
pub use DiscoveryExt;