upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/git/handlers.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 15:41:32 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 15:41:32 +0000
commitc54ce061d6d278cce8362d5af085808ca60c239b (patch)
treeec967d6195d9f7ec4f061449596611afe3a0950f /src/git/handlers.rs
parente0ad39a489b3398f8208713bf728db0cb11475b0 (diff)
parent113928aa84894ea8f65c247d9987527e792b32a9 (diff)
feat: announcement purgatory
Extends purgatory to hold repository announcements until git data arrives, preventing empty repositories from being served to clients. When an announcement is received, a bare repo is created immediately and the announcement is held in purgatory. It is only promoted and served once a git push confirms real content exists. If no push arrives before expiry, the bare repo is deleted and the announcement is silently discarded. Key behaviours: - Soft expiry: announcements are hidden from clients but kept alive while git pushes are in progress, reviving on successful push - Expiry is extended when a matching state event or git push is observed - NIP-09 deletion events remove announcements from purgatory - Purgatory state (announcements, state events, PR events, expired set) is persisted to disk on graceful shutdown and restored on startup, with elapsed downtime subtracted from expiry deadlines - Purgatory announcements drive StateOnly sync in the sync system so state events are fetched from listed relays before promotion - SyncLevel added to RepoSyncIndex to distinguish purgatory repos (StateOnly) from promoted repos (Full L2+L3 sync)
Diffstat (limited to 'src/git/handlers.rs')
-rw-r--r--src/git/handlers.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/git/handlers.rs b/src/git/handlers.rs
index 28cb47f..f43cbb6 100644
--- a/src/git/handlers.rs
+++ b/src/git/handlers.rs
@@ -17,8 +17,9 @@ use super::subprocess::GitSubprocess;
17 17
18use crate::git::authorization::{authorize_push, parse_pushed_refs}; 18use crate::git::authorization::{authorize_push, parse_pushed_refs};
19use crate::git::sync::process_newly_available_git_data; 19use crate::git::sync::process_newly_available_git_data;
20use crate::nostr::builder::SharedDatabase; 20use crate::nostr::builder::{Nip34WritePolicy, SharedDatabase};
21use crate::purgatory::Purgatory; 21use crate::purgatory::Purgatory;
22use crate::sync::rejected_index::RejectedEventsIndex;
22 23
23/// Handle GET /info/refs?service=git-{upload,receive}-pack 24/// Handle GET /info/refs?service=git-{upload,receive}-pack
24/// 25///
@@ -258,6 +259,8 @@ pub async fn handle_receive_pack(
258 purgatory: Arc<Purgatory>, 259 purgatory: Arc<Purgatory>,
259 git_data_path: &str, 260 git_data_path: &str,
260 git_protocol: Option<&str>, 261 git_protocol: Option<&str>,
262 write_policy: Arc<Nip34WritePolicy>,
263 rejected_events_index: Arc<RejectedEventsIndex>,
261) -> Result<Response<Full<Bytes>>, GitError> { 264) -> Result<Response<Full<Bytes>>, GitError> {
262 debug!("Handling receive-pack for {:?}", repo_path); 265 debug!("Handling receive-pack for {:?}", repo_path);
263 266
@@ -397,6 +400,8 @@ pub async fn handle_receive_pack(
397 Some(&relay), 400 Some(&relay),
398 &purgatory, 401 &purgatory,
399 git_data_path_buf, 402 git_data_path_buf,
403 Some(&write_policy),
404 Some(&rejected_events_index),
400 ) 405 )
401 .await 406 .await
402 { 407 {