Struct nostr_database::memory::MemoryDatabase
source · pub struct MemoryDatabase { /* private fields */ }Expand description
Memory Database (RAM)
Implementations§
source§impl MemoryDatabase
impl MemoryDatabase
sourcepub fn with_opts(opts: MemoryDatabaseOptions) -> Self
pub fn with_opts(opts: MemoryDatabaseOptions) -> Self
New Memory database
Trait Implementations§
source§impl Debug for MemoryDatabase
impl Debug for MemoryDatabase
source§impl Default for MemoryDatabase
impl Default for MemoryDatabase
source§impl NostrDatabase for MemoryDatabase
impl NostrDatabase for MemoryDatabase
§type Err = DatabaseError
type Err = DatabaseError
Error
source§fn backend(&self) -> Backend
fn backend(&self) -> Backend
Name of the backend database used (ex. rocksdb, lmdb, sqlite, indexeddb, …)
source§fn save_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn bulk_import<'life0, 'async_trait>(
&'life0 self,
events: BTreeSet<Event>
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn bulk_import<'life0, 'async_trait>(
&'life0 self,
events: BTreeSet<Event>
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Bulk import events into database Read more
source§fn has_event_already_been_saved<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_event_already_been_saved<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if
Event has already been savedsource§fn has_event_already_been_seen<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_event_already_been_seen<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if
EventId has already been seensource§fn has_event_id_been_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_event_id_been_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: &'life1 EventId
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if
EventId has been deletedsource§fn has_coordinate_been_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
coordinate: &'life1 Coordinate,
timestamp: Timestamp
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_coordinate_been_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
coordinate: &'life1 Coordinate,
timestamp: Timestamp
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if event with
Coordinate has been deleted before Timestampsource§fn event_id_seen<'life0, 'async_trait>(
&'life0 self,
event_id: EventId,
relay_url: Url
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn event_id_seen<'life0, 'async_trait>(
&'life0 self,
event_id: EventId,
relay_url: Url
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn event_seen_on_relays<'life0, 'async_trait>(
&'life0 self,
event_id: EventId
) -> Pin<Box<dyn Future<Output = Result<Option<HashSet<Url>>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn event_seen_on_relays<'life0, 'async_trait>(
&'life0 self,
event_id: EventId
) -> Pin<Box<dyn Future<Output = Result<Option<HashSet<Url>>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get list of relays that have seen the
EventIdsource§fn event_by_id<'life0, 'async_trait>(
&'life0 self,
event_id: EventId
) -> Pin<Box<dyn Future<Output = Result<Event, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn event_by_id<'life0, 'async_trait>(
&'life0 self,
event_id: EventId
) -> Pin<Box<dyn Future<Output = Result<Event, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn count<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn query<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>,
order: Order
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>,
order: Order
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Query store with filters
source§fn event_ids_by_filters<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>,
order: Order
) -> Pin<Box<dyn Future<Output = Result<Vec<EventId>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn event_ids_by_filters<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>,
order: Order
) -> Pin<Box<dyn Future<Output = Result<Vec<EventId>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get event IDs by filters
source§fn negentropy_items<'life0, 'async_trait>(
&'life0 self,
filter: Filter
) -> Pin<Box<dyn Future<Output = Result<Vec<(EventId, Timestamp)>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn negentropy_items<'life0, 'async_trait>(
&'life0 self,
filter: Filter
) -> Pin<Box<dyn Future<Output = Result<Vec<(EventId, Timestamp)>, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get
negentropy itemsAuto Trait Implementations§
impl Freeze for MemoryDatabase
impl !RefUnwindSafe for MemoryDatabase
impl Send for MemoryDatabase
impl Sync for MemoryDatabase
impl Unpin for MemoryDatabase
impl !UnwindSafe for MemoryDatabase
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoNostrDatabase for Twhere
T: NostrDatabase + 'static,
impl<T> IntoNostrDatabase for Twhere
T: NostrDatabase + 'static,
fn into_nostr_database(self) -> Arc<dyn NostrDatabase<Err = DatabaseError>>
source§impl<T> NostrDatabaseExt for Twhere
T: NostrDatabase + ?Sized,
impl<T> NostrDatabaseExt for Twhere
T: NostrDatabase + ?Sized,
source§fn profile<'life0, 'async_trait>(
&'life0 self,
public_key: PublicKey
) -> Pin<Box<dyn Future<Output = Result<Profile, Self::Err>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn profile<'life0, 'async_trait>(
&'life0 self,
public_key: PublicKey
) -> Pin<Box<dyn Future<Output = Result<Profile, Self::Err>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get profile metadata