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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! # Connection Management
//!
//! Connection pooling, health monitoring, and retry logic for Bittensor chain interactions.
//!
//! This module provides robust connection handling with:
//!
//! - **Connection Pool**: Manages multiple WebSocket connections with automatic failover
//! - **Health Checker**: Periodic health monitoring with configurable thresholds
//! - **Circuit Breaker**: Prevents cascade failures during extended outages
//! - **Retry Node**: Exponential backoff with jitter for transient errors
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ ConnectionPool │
//! │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
//! │ │ Connection 1│ │ Connection 2│ │ Connection 3│ ... │
//! │ │ (healthy) │ │ (healthy) │ │ (unhealthy) │ │
//! │ └─────────────┘ └─────────────┘ └─────────────┘ │
//! │ │ │ │
//! │ └────────────────┼──────────────────────────────────│
//! │ ▼ │
//! │ HealthChecker │
//! │ (periodic monitoring) │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Example
//!
//! ```rust,no_run
//! use bittensor_rs::connect::{ConnectionPoolBuilder, RetryConfig, HealthChecker};
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let endpoints = vec![
//! "wss://entrypoint-finney.opentensor.ai:443".to_string(),
//! ];
//!
//! let pool = Arc::new(
//! ConnectionPoolBuilder::new(endpoints)
//! .max_connections(3)
//! .retry_config(RetryConfig::network())
//! .build()
//! );
//!
//! pool.initialize().await?;
//!
//! // Get a healthy client
//! let client = pool.get_healthy_client().await?;
//! # Ok(())
//! # }
//! ```
// Re-export core types from submodules
pub use crateRetryConfig;
pub use crate;
pub use ;
pub use ;
pub use ;
pub use ;
/// Common imports for connection-related code