From c31a313ccf781e54fa15942bc882c1b113d3f590 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 24 Feb 2026 11:36:39 +0000 Subject: rename: fetch_repository_data -> fetch_repository_data_{excluding,with}_purgatory The old name was ambiguous - it wasn't clear whether purgatory was included or not. The two variants are now explicitly named: - fetch_repository_data_excluding_purgatory: DB only - fetch_repository_data_with_purgatory: DB + purgatory overlay SyncContext trait method also renamed to fetch_repository_data_with_purgatory to match the free function it delegates to. --- src/purgatory/sync/context.rs | 17 +++++++++++++---- src/purgatory/sync/functions.rs | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/purgatory/sync') diff --git a/src/purgatory/sync/context.rs b/src/purgatory/sync/context.rs index 8297515..1bba961 100644 --- a/src/purgatory/sync/context.rs +++ b/src/purgatory/sync/context.rs @@ -87,7 +87,10 @@ pub trait SyncContext: Send + Sync { /// /// # Returns /// Repository data including announcements and state events - async fn fetch_repository_data(&self, identifier: &str) -> Result; + async fn fetch_repository_data_with_purgatory( + &self, + identifier: &str, + ) -> Result; /// Get all OIDs needed for purgatory events with this identifier. /// @@ -283,7 +286,10 @@ impl SyncContext for RealSyncContext { urls } - async fn fetch_repository_data(&self, identifier: &str) -> Result { + async fn fetch_repository_data_with_purgatory( + &self, + identifier: &str, + ) -> Result { // Use the purgatory-aware variant so that clone URLs from announcements still // in purgatory (not yet promoted) are available. Without this, the sync loop // would find no URLs to fetch from and the announcement could never be promoted @@ -585,7 +591,7 @@ pub mod mock { /// assert_eq!(mock.fetch_log(), vec!["https://github.com/foo/bar.git"]); /// ``` pub struct MockSyncContext { - /// Repository data to return from fetch_repository_data + /// Repository data to return from fetch_repository_data_with_purgatory repo_data: RwLock>, /// Clone URLs available for the repository (from announcements) @@ -732,7 +738,10 @@ pub mod mock { self.pr_clone_urls.clone() } - async fn fetch_repository_data(&self, _identifier: &str) -> Result { + async fn fetch_repository_data_with_purgatory( + &self, + _identifier: &str, + ) -> Result { // Return stored repo_data or create a minimal one with clone URLs if let Some(data) = self.repo_data.read().unwrap().as_ref() { // Clone the data - this is a test mock so efficiency isn't critical diff --git a/src/purgatory/sync/functions.rs b/src/purgatory/sync/functions.rs index 9207d58..bd5c0c0 100644 --- a/src/purgatory/sync/functions.rs +++ b/src/purgatory/sync/functions.rs @@ -104,7 +104,7 @@ pub async fn sync_identifier_next_url( } // 3. Get repository data - let repo_data = match ctx.fetch_repository_data(identifier).await { + let repo_data = match ctx.fetch_repository_data_with_purgatory(identifier).await { Ok(data) => data, Err(e) => { debug!( @@ -228,7 +228,7 @@ pub async fn get_throttled_domains_with_untried_urls( throttle_manager: &ThrottleManager, git_naughty_list: &NaughtyListTracker, ) -> Vec { - let repo_data = match ctx.fetch_repository_data(identifier).await { + let repo_data = match ctx.fetch_repository_data_with_purgatory(identifier).await { Ok(data) => data, Err(_) => return vec![], }; @@ -333,7 +333,7 @@ pub async fn sync_identifier_from_url( }; // Get repository data for target repo path - let repo_data = match ctx.fetch_repository_data(identifier).await { + let repo_data = match ctx.fetch_repository_data_with_purgatory(identifier).await { Ok(data) => data, Err(e) => { debug!( -- cgit v1.2.3