diff options
Diffstat (limited to 'src/sync/rejected_index.rs')
| -rw-r--r-- | src/sync/rejected_index.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sync/rejected_index.rs b/src/sync/rejected_index.rs index f5ffef4..a9d7a4d 100644 --- a/src/sync/rejected_index.rs +++ b/src/sync/rejected_index.rs | |||
| @@ -54,9 +54,9 @@ | |||
| 54 | //! | 54 | //! |
| 55 | //! # Usage | 55 | //! # Usage |
| 56 | //! | 56 | //! |
| 57 | //! ```rust,no_run | 57 | //! ```rust,ignore |
| 58 | //! use ngit_grasp::sync::rejected_index::{RejectedEventsIndex, RejectionReason}; | 58 | //! use ngit_grasp::sync::rejected_index::{RejectedEventsIndex, RejectionReason}; |
| 59 | //! use nostr_sdk::Event; | 59 | //! use nostr_sdk::{Event, PublicKey}; |
| 60 | //! use std::time::Duration; | 60 | //! use std::time::Duration; |
| 61 | //! | 61 | //! |
| 62 | //! let index = RejectedEventsIndex::new( | 62 | //! let index = RejectedEventsIndex::new( |
| @@ -64,7 +64,7 @@ | |||
| 64 | //! Duration::from_secs(604800), // cold index: 7 days | 64 | //! Duration::from_secs(604800), // cold index: 7 days |
| 65 | //! ); | 65 | //! ); |
| 66 | //! | 66 | //! |
| 67 | //! // Add rejected announcement | 67 | //! // Add rejected announcement (event is a nostr_sdk::Event) |
| 68 | //! index.add_announcement( | 68 | //! index.add_announcement( |
| 69 | //! event.clone(), | 69 | //! event.clone(), |
| 70 | //! event.pubkey, | 70 | //! event.pubkey, |
| @@ -116,16 +116,19 @@ struct HotCacheEntry { | |||
| 116 | event: Event, | 116 | event: Event, |
| 117 | pubkey: PublicKey, | 117 | pubkey: PublicKey, |
| 118 | identifier: String, | 118 | identifier: String, |
| 119 | #[allow(dead_code)] // Used for metrics/debugging in future | ||
| 119 | reason: RejectionReason, | 120 | reason: RejectionReason, |
| 120 | cached_at: Instant, | 121 | cached_at: Instant, |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | /// Entry in the cold index (metadata only) | 124 | /// Entry in the cold index (metadata only) |
| 125 | /// | ||
| 126 | /// Note: event_id is stored as the HashMap key, not in this struct | ||
| 124 | #[derive(Debug, Clone)] | 127 | #[derive(Debug, Clone)] |
| 125 | struct ColdIndexEntry { | 128 | struct ColdIndexEntry { |
| 126 | event_id: EventId, | ||
| 127 | pubkey: PublicKey, | 129 | pubkey: PublicKey, |
| 128 | identifier: String, | 130 | identifier: String, |
| 131 | #[allow(dead_code)] // Used for metrics/debugging in future | ||
| 129 | reason: RejectionReason, | 132 | reason: RejectionReason, |
| 130 | rejected_at: Instant, | 133 | rejected_at: Instant, |
| 131 | } | 134 | } |
| @@ -235,7 +238,6 @@ impl ColdIndex { | |||
| 235 | reason: RejectionReason, | 238 | reason: RejectionReason, |
| 236 | ) { | 239 | ) { |
| 237 | let entry = ColdIndexEntry { | 240 | let entry = ColdIndexEntry { |
| 238 | event_id, | ||
| 239 | pubkey, | 241 | pubkey, |
| 240 | identifier, | 242 | identifier, |
| 241 | reason, | 243 | reason, |