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-04 17:03:40 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-04 17:03:40 +0000
commitb167f1b2ae7edbcab95554b5203d22d9e372c8b5 (patch)
tree39b3bb879302cb6a4eaabded4a5d20f7d0d68ffc /src/sync/mod.rs
parentfdbc8895e1e9e712882bd854908295a95e7afcb9 (diff)
feat(sync): Phase 1 MVP - single relay proactive sync
- Add src/sync/ module with SyncManager - Add NGIT_SYNC_RELAY_URL config option - Subscribe to kind 30617 on configured relay - Validate synced events through Nip34WritePolicy - Integration test with two TestRelay instances
Diffstat (limited to 'src/sync/mod.rs')
-rw-r--r--src/sync/mod.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sync/mod.rs b/src/sync/mod.rs
new file mode 100644
index 0000000..279471b
--- /dev/null
+++ b/src/sync/mod.rs
@@ -0,0 +1,22 @@
1//! Proactive Sync Module for GRASP-02
2//!
3//! This module implements proactive synchronization of kind 30617 (repository state)
4//! events from configured relay(s). Events are validated through the same write policy
5//! as directly-submitted events.
6
7mod connection;
8mod manager;
9
10pub use manager::SyncManager;
11
12use std::net::SocketAddr;
13
14/// Synthetic source address used for synced events
15///
16/// This distinguishes synced events from directly-submitted events in logs and metrics.
17/// Uses 127.0.0.2:0 as a recognizable "synced event" marker.
18pub const SYNC_SOURCE_ADDR: SocketAddr =
19 SocketAddr::new(std::net::IpAddr::V4(std::net::Ipv4Addr::new(127, 0, 0, 2)), 0);
20
21/// Kind for repository state events (NIP-34)
22pub const KIND_REPOSITORY_STATE: u16 = 30617; \ No newline at end of file