diff options
Diffstat (limited to 'src/nostr/policy/mod.rs')
| -rw-r--r-- | src/nostr/policy/mod.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/nostr/policy/mod.rs b/src/nostr/policy/mod.rs index c958586..1566b6c 100644 --- a/src/nostr/policy/mod.rs +++ b/src/nostr/policy/mod.rs | |||
| @@ -20,7 +20,6 @@ pub use crate::git::sync::AlignmentResult; | |||
| 20 | 20 | ||
| 21 | use super::SharedDatabase; | 21 | use super::SharedDatabase; |
| 22 | use crate::purgatory::Purgatory; | 22 | use crate::purgatory::Purgatory; |
| 23 | use crate::sync::RepoSyncIndex; | ||
| 24 | use nostr_relay_builder::LocalRelay; | 23 | use nostr_relay_builder::LocalRelay; |
| 25 | use std::sync::Arc; | 24 | use std::sync::Arc; |
| 26 | 25 | ||
| @@ -35,8 +34,6 @@ pub struct PolicyContext { | |||
| 35 | pub local_relay: Arc<std::sync::RwLock<Option<LocalRelay>>>, | 34 | pub local_relay: Arc<std::sync::RwLock<Option<LocalRelay>>>, |
| 36 | /// Configuration reference for policy settings (includes blacklists) | 35 | /// Configuration reference for policy settings (includes blacklists) |
| 37 | pub config: crate::config::Config, | 36 | pub config: crate::config::Config, |
| 38 | /// Repo sync index for registering purgatory announcements (set after SyncManager creation) | ||
| 39 | pub repo_sync_index: Arc<std::sync::RwLock<Option<RepoSyncIndex>>>, | ||
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | impl PolicyContext { | 39 | impl PolicyContext { |
| @@ -54,7 +51,6 @@ impl PolicyContext { | |||
| 54 | purgatory, | 51 | purgatory, |
| 55 | local_relay: Arc::new(std::sync::RwLock::new(None)), | 52 | local_relay: Arc::new(std::sync::RwLock::new(None)), |
| 56 | config, | 53 | config, |
| 57 | repo_sync_index: Arc::new(std::sync::RwLock::new(None)), | ||
| 58 | } | 54 | } |
| 59 | } | 55 | } |
| 60 | 56 | ||
| @@ -72,19 +68,4 @@ impl PolicyContext { | |||
| 72 | let guard = self.local_relay.read().unwrap(); | 68 | let guard = self.local_relay.read().unwrap(); |
| 73 | guard.clone() | 69 | guard.clone() |
| 74 | } | 70 | } |
| 75 | |||
| 76 | /// Set the repo sync index after SyncManager has been created. | ||
| 77 | /// | ||
| 78 | /// This allows purgatory announcements submitted by users to be registered | ||
| 79 | /// in the sync index so state event sync starts promptly. | ||
| 80 | pub fn set_repo_sync_index(&self, index: RepoSyncIndex) { | ||
| 81 | let mut guard = self.repo_sync_index.write().unwrap(); | ||
| 82 | *guard = Some(index); | ||
| 83 | } | ||
| 84 | |||
| 85 | /// Get a clone of the repo sync index if it has been set. | ||
| 86 | pub fn get_repo_sync_index(&self) -> Option<RepoSyncIndex> { | ||
| 87 | let guard = self.repo_sync_index.read().unwrap(); | ||
| 88 | guard.clone() | ||
| 89 | } | ||
| 90 | } | 71 | } |