upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sync/mod.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-10 11:36:08 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-10 11:36:08 +0000
commitea561062c0f08d608f48b6ccd6f8a4b8743b6e3b (patch)
tree1014aa98783cf1bc6d910f0e4db19b7d5d5d2e62 /src/sync/mod.rs
parent39e782b12fce1776f2ad0b0f5430749533cb80ea (diff)
sync: integrate health tracking and connection storage
Diffstat (limited to 'src/sync/mod.rs')
-rw-r--r--src/sync/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sync/mod.rs b/src/sync/mod.rs
index fb09896..9ac62ed 100644
--- a/src/sync/mod.rs
+++ b/src/sync/mod.rs
@@ -14,6 +14,7 @@
14 14
15pub mod algorithms; 15pub mod algorithms;
16pub mod filters; 16pub mod filters;
17pub mod health;
17pub mod relay_connection; 18pub mod relay_connection;
18pub mod self_subscriber; 19pub mod self_subscriber;
19 20
@@ -26,6 +27,9 @@ pub use relay_connection::{RelayConnection, RelayEvent};
26// Re-export self-subscriber types 27// Re-export self-subscriber types
27pub use self_subscriber::{RelayAction, SelfSubscriber}; 28pub use self_subscriber::{RelayAction, SelfSubscriber};
28 29
30// Re-export health tracking types
31pub use health::RelayHealthTracker;
32
29use std::collections::{HashMap, HashSet}; 33use std::collections::{HashMap, HashSet};
30use std::sync::Arc; 34use std::sync::Arc;
31 35
@@ -339,6 +343,12 @@ pub struct SyncManager {
339 relay_sync_index: RelaySyncIndex, 343 relay_sync_index: RelaySyncIndex,
340 /// In-flight subscription batches 344 /// In-flight subscription batches
341 pending_sync_index: PendingSyncIndex, 345 pending_sync_index: PendingSyncIndex,
346 /// Active relay connections - keyed by relay URL
347 connections: HashMap<String, RelayConnection>,
348 /// Health tracker for relay connection state
349 health_tracker: Arc<RelayHealthTracker>,
350 /// Counter for generating unique batch IDs
351 next_batch_id: u64,
342} 352}
343 353
344impl SyncManager { 354impl SyncManager {
@@ -366,6 +376,9 @@ impl SyncManager {
366 repo_sync_index: Arc::new(RwLock::new(HashMap::new())), 376 repo_sync_index: Arc::new(RwLock::new(HashMap::new())),
367 relay_sync_index: Arc::new(RwLock::new(HashMap::new())), 377 relay_sync_index: Arc::new(RwLock::new(HashMap::new())),
368 pending_sync_index: Arc::new(RwLock::new(HashMap::new())), 378 pending_sync_index: Arc::new(RwLock::new(HashMap::new())),
379 connections: HashMap::new(),
380 health_tracker: Arc::new(RelayHealthTracker::new(config)),
381 next_batch_id: 0,
369 } 382 }
370 } 383 }
371 384