pub struct DatabaseIndexes { /* private fields */ }
Expand description

Database Indexes

Implementations§

source§

impl DatabaseIndexes

source

pub fn new() -> Self

New empty database indexes

source

pub async fn bulk_index<'a, E>(&self, events: BTreeSet<E>) -> HashSet<EventId>
where E: Into<EventOrTempEvent<'a>>,

Bulk index

source

pub async fn bulk_import(&self, events: BTreeSet<Event>) -> BTreeSet<Event>

Bulk import

Take a set of Event, index them and return only the ones that must be stored into the database

source

pub async fn index_event(&self, event: &Event) -> EventIndexResult

Index Event

This method assume that Event was already verified

source

pub async fn query<I>(&self, filters: I, order: Order) -> Vec<EventId>
where I: IntoIterator<Item = Filter>,

Query

source

pub async fn count<I>(&self, filters: I) -> usize
where I: IntoIterator<Item = Filter>,

Count events

source

pub async fn negentropy_items( &self, filter: Filter ) -> Vec<(EventId, Timestamp)>

Get negentropy items

source

pub async fn has_event_id_been_deleted(&self, event_id: &EventId) -> bool

Check if an event with EventId has been deleted

source

pub async fn has_coordinate_been_deleted( &self, coordinate: &Coordinate, timestamp: Timestamp ) -> bool

Check if event with Coordinate has been deleted before Timestamp

source

pub async fn delete(&self, filter: Filter) -> Option<HashSet<EventId>>

Delete all events that match Filter

If return None, means that all events must be deleted from DB

source

pub async fn clear(&self)

Clear indexes

Trait Implementations§

source§

impl Clone for DatabaseIndexes

source§

fn clone(&self) -> DatabaseIndexes

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DatabaseIndexes

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DatabaseIndexes

source§

fn default() -> DatabaseIndexes

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> AsyncTraitDeps for T

source§

impl<T> SendOutsideWasm for T
where T: Send,

source§

impl<T> SyncOutsideWasm for T
where T: Sync,