Skip to content

Commit

Permalink
database: partially revert commit 664ffe3
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Mar 13, 2024
1 parent b594272 commit e38544c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions crates/nostr-database/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ArcEventIndex = Arc<EventIndex>;

/// Event Index
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct EventIndex {
struct EventIndex {
/// Timestamp (seconds)
created_at: Timestamp,
/// Event ID
Expand Down Expand Up @@ -101,9 +101,8 @@ impl From<[u8; 32]> for PublicKeyPrefix {
}
}

/// Filter Index
#[derive(Default)]
pub struct FilterIndex {
struct FilterIndex {
ids: HashSet<EventId>,
authors: HashSet<PublicKeyPrefix>,
kinds: HashSet<Kind>,
Expand Down Expand Up @@ -144,7 +143,6 @@ impl FilterIndex {
self.kinds.is_empty() || self.kinds.contains(kind)
}

/// Determine if [`FilterIndex`] match given [`EventIndex`].
pub fn match_event(&self, event: &EventIndex) -> bool {
self.ids_match(event)
&& self.since.map_or(true, |t| event.created_at >= t)
Expand Down
2 changes: 1 addition & 1 deletion crates/nostr-database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod temp;
pub use self::error::DatabaseError;
#[cfg(feature = "flatbuf")]
pub use self::flatbuffers::{FlatBufferBuilder, FlatBufferDecode, FlatBufferEncode};
pub use self::index::{DatabaseIndexes, EventIndex, EventIndexResult, FilterIndex};
pub use self::index::{DatabaseIndexes, EventIndexResult};
pub use self::memory::{MemoryDatabase, MemoryDatabaseOptions};
pub use self::profile::Profile;
#[cfg(feature = "flatbuf")]
Expand Down

0 comments on commit e38544c

Please sign in to comment.