Skip to content

Commit

Permalink
db: remove save_events method
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Oct 17, 2023
1 parent 7f8a765 commit efb5f3c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
1 change: 1 addition & 0 deletions crates/nostr-sdk-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ async-trait = "0.1"
nostr = { version = "0.24", path = "../nostr", default-features = false, features = ["std"] }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
tracing = { workspace = true, features = ["std"] }
3 changes: 0 additions & 3 deletions crates/nostr-sdk-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ pub trait NostrDatabase: AsyncTraitDeps {
/// Return `true` if event was successfully saved into database.
async fn save_event(&self, event: &Event) -> Result<bool, Self::Err>;

/// Save multiple [`Event`] into store
async fn save_events(&self, events: Vec<Event>) -> Result<(), Self::Err>;

/// Check if [`EventId`] has already been seen
async fn has_event_already_been_seen(&self, event_id: EventId) -> Result<bool, Self::Err>;

Expand Down
8 changes: 0 additions & 8 deletions crates/nostr-sdk-db/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,6 @@ impl NostrDatabase for MemoryDatabase {
self._save_event(&mut events, event.clone()).await
}

async fn save_events(&self, list: Vec<Event>) -> Result<(), Self::Err> {
let mut events = self.events.write().await;
for event in list.into_iter() {
self._save_event(&mut events, event).await?;
}
Ok(())
}

async fn has_event_already_been_seen(&self, event_id: EventId) -> Result<bool, Self::Err> {
let seen_event_ids = self.seen_event_ids.read().await;
Ok(seen_event_ids.contains_key(&event_id))
Expand Down

0 comments on commit efb5f3c

Please sign in to comment.