upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-18 17:12:17 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-18 17:12:17 +0000
commitd76003b629a4a03dba23a8a1c41da6e4ac4c30cf (patch)
tree38412fdeed3e7996923603fe1964db4e5ce94bdc /src/main.rs
parent806936e7d1aab5dfd0c2ad6b98a115122dc1785c (diff)
feat: upgrade repo to Full sync and trigger PR event subscription after announcement promotion
When git data arrives for a purgatory announcement and promotes it to the database, the relay now: 1. Upgrades the announcement's sync level in RepoSyncIndex from StateOnly to Full (git/sync.rs: process_purgatory_announcements) 2. Sends AddFilters actions to SyncManager for all connected relays, using Full sync filters (Layer 2 #a/#A/#q) to subscribe to PR events (purgatory/sync/context.rs: RealSyncContext.process_newly_available_git_data) 3. For user-submitted purgatory announcements, registers the repo in RepoSyncIndex with StateOnly level and sends AddFilters to SyncManager so it discovers and connects to relays listed in the announcement tags (nostr/builder.rs: handle_announcement AcceptPurgatory path) The RealSyncContext now accepts optional repo_sync_index and sync_action_tx parameters. main.rs wires these up from SyncManager. PolicyContext gains repo_sync_index and sync_action_tx fields for the write policy path.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index ab6ede7..3ff30fb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -132,6 +132,24 @@ async fn main() -> Result<()> {
132 // Get a reference to the rejected events index for shutdown persistence 132 // Get a reference to the rejected events index for shutdown persistence
133 let shutdown_rejected_index = sync_manager.rejected_events_index(); 133 let shutdown_rejected_index = sync_manager.rejected_events_index();
134 134
135 // Get a reference to the repo sync index for upgrading sync levels on promotion
136 let repo_sync_index = sync_manager.repo_sync_index();
137
138 // Set the repo sync index on the write policy so user-submitted purgatory
139 // announcements can trigger relay discovery (connect to relays in announcement tags)
140 relay_with_db
141 .write_policy
142 .set_repo_sync_index(repo_sync_index.clone());
143
144 // Get the action sender BEFORE consuming sync_manager with spawn
145 let action_tx = sync_manager.action_tx();
146
147 // Set the sync action sender so the write policy can trigger relay connections
148 // when user-submitted purgatory announcements are registered with StateOnly level
149 if let Some(tx) = action_tx.clone() {
150 relay_with_db.write_policy.set_sync_action_tx(tx);
151 }
152
135 tokio::spawn(async move { 153 tokio::spawn(async move {
136 sync_manager.run().await; 154 sync_manager.run().await;
137 }); 155 });
@@ -184,6 +202,8 @@ async fn main() -> Result<()> {
184 Some(config.domain.clone()), 202 Some(config.domain.clone()),
185 Some(relay_with_db.relay.clone()), 203 Some(relay_with_db.relay.clone()),
186 git_naughty_list.clone(), 204 git_naughty_list.clone(),
205 Some(repo_sync_index),
206 action_tx,
187 )); 207 ));
188 208
189 // Create throttle manager for rate limiting remote git servers 209 // Create throttle manager for rate limiting remote git servers