diff options
Diffstat (limited to 'src/purgatory/sync/context.rs')
| -rw-r--r-- | src/purgatory/sync/context.rs | 17 |
1 files changed, 13 insertions, 4 deletions
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 { | |||
| 87 | /// | 87 | /// |
| 88 | /// # Returns | 88 | /// # Returns |
| 89 | /// Repository data including announcements and state events | 89 | /// Repository data including announcements and state events |
| 90 | async fn fetch_repository_data(&self, identifier: &str) -> Result<RepositoryData>; | 90 | async fn fetch_repository_data_with_purgatory( |
| 91 | &self, | ||
| 92 | identifier: &str, | ||
| 93 | ) -> Result<RepositoryData>; | ||
| 91 | 94 | ||
| 92 | /// Get all OIDs needed for purgatory events with this identifier. | 95 | /// Get all OIDs needed for purgatory events with this identifier. |
| 93 | /// | 96 | /// |
| @@ -283,7 +286,10 @@ impl SyncContext for RealSyncContext { | |||
| 283 | urls | 286 | urls |
| 284 | } | 287 | } |
| 285 | 288 | ||
| 286 | async fn fetch_repository_data(&self, identifier: &str) -> Result<RepositoryData> { | 289 | async fn fetch_repository_data_with_purgatory( |
| 290 | &self, | ||
| 291 | identifier: &str, | ||
| 292 | ) -> Result<RepositoryData> { | ||
| 287 | // Use the purgatory-aware variant so that clone URLs from announcements still | 293 | // Use the purgatory-aware variant so that clone URLs from announcements still |
| 288 | // in purgatory (not yet promoted) are available. Without this, the sync loop | 294 | // in purgatory (not yet promoted) are available. Without this, the sync loop |
| 289 | // would find no URLs to fetch from and the announcement could never be promoted | 295 | // would find no URLs to fetch from and the announcement could never be promoted |
| @@ -585,7 +591,7 @@ pub mod mock { | |||
| 585 | /// assert_eq!(mock.fetch_log(), vec!["https://github.com/foo/bar.git"]); | 591 | /// assert_eq!(mock.fetch_log(), vec!["https://github.com/foo/bar.git"]); |
| 586 | /// ``` | 592 | /// ``` |
| 587 | pub struct MockSyncContext { | 593 | pub struct MockSyncContext { |
| 588 | /// Repository data to return from fetch_repository_data | 594 | /// Repository data to return from fetch_repository_data_with_purgatory |
| 589 | repo_data: RwLock<Option<RepositoryData>>, | 595 | repo_data: RwLock<Option<RepositoryData>>, |
| 590 | 596 | ||
| 591 | /// Clone URLs available for the repository (from announcements) | 597 | /// Clone URLs available for the repository (from announcements) |
| @@ -732,7 +738,10 @@ pub mod mock { | |||
| 732 | self.pr_clone_urls.clone() | 738 | self.pr_clone_urls.clone() |
| 733 | } | 739 | } |
| 734 | 740 | ||
| 735 | async fn fetch_repository_data(&self, _identifier: &str) -> Result<RepositoryData> { | 741 | async fn fetch_repository_data_with_purgatory( |
| 742 | &self, | ||
| 743 | _identifier: &str, | ||
| 744 | ) -> Result<RepositoryData> { | ||
| 736 | // Return stored repo_data or create a minimal one with clone URLs | 745 | // Return stored repo_data or create a minimal one with clone URLs |
| 737 | if let Some(data) = self.repo_data.read().unwrap().as_ref() { | 746 | if let Some(data) = self.repo_data.read().unwrap().as_ref() { |
| 738 | // Clone the data - this is a test mock so efficiency isn't critical | 747 | // Clone the data - this is a test mock so efficiency isn't critical |