diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 15:41:32 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 15:41:32 +0000 |
| commit | c54ce061d6d278cce8362d5af085808ca60c239b (patch) | |
| tree | ec967d6195d9f7ec4f061449596611afe3a0950f /tests/sync/mod.rs | |
| parent | e0ad39a489b3398f8208713bf728db0cb11475b0 (diff) | |
| parent | 113928aa84894ea8f65c247d9987527e792b32a9 (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 'tests/sync/mod.rs')
| -rw-r--r-- | tests/sync/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/sync/mod.rs b/tests/sync/mod.rs index 400341f..70c6981 100644 --- a/tests/sync/mod.rs +++ b/tests/sync/mod.rs | |||
| @@ -82,14 +82,12 @@ | |||
| 82 | //! **Example from `discovery.rs`:** | 82 | //! **Example from `discovery.rs`:** |
| 83 | //! ```rust | 83 | //! ```rust |
| 84 | //! #[tokio::test] | 84 | //! #[tokio::test] |
| 85 | //! async fn test_recursive_relay_discovery() { | 85 | //! async fn test_discovers_layer3_via_layer2() { |
| 86 | //! // Multi-relay orchestration | 86 | //! // Multi-relay orchestration |
| 87 | //! let relay1 = TestRelay::start().await; | 87 | //! let relay_a = TestRelay::start().await; |
| 88 | //! let relay2 = TestRelay::start().await; | 88 | //! let relay_b = TestRelay::start_with_sync(None).await; |
| 89 | //! let relay3 = TestRelay::start().await; | ||
| 90 | //! | 89 | //! |
| 91 | //! // relay1 announces relay2, relay2 announces relay3 | 90 | //! // relay_b receives announcement listing relay_a, discovers and syncs from it |
| 92 | //! // Verify relay1 discovers relay3 through chain | ||
| 93 | //! } | 91 | //! } |
| 94 | //! ``` | 92 | //! ``` |
| 95 | //! | 93 | //! |