Struct DatabaseHelper

Source
pub struct DatabaseHelper { /* private fields */ }
Expand description

Database Indexes

Implementations§

Source§

impl DatabaseHelper

Source

pub fn unbounded() -> Self

Unbounded database helper

Source

pub fn bounded(max: usize) -> Self

Bounded database helper

Source

pub async fn qtxn(&self) -> QueryTransaction

Query transaction

Source

pub async fn bulk_load(&self, events: BTreeSet<Event>) -> HashSet<EventId>

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) -> DatabaseEventResult

Index Event

This method assumes that Event was already verified

Source

pub async fn event_by_id(&self, id: &EventId) -> Option<Event>

Get Event by ID

Source

pub async fn has_event(&self, id: &EventId) -> bool

Check if event exists

Source

pub async fn query(&self, filter: Filter) -> Events

Query

Source

pub fn fast_query<'a>( &self, txn: &'a QueryTransaction, filter: Filter, ) -> Box<dyn Iterator<Item = &'a Event> + 'a>

Query

Source

pub async fn count(&self, filter: Filter) -> usize

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<'a>( &self, coordinate: &'a CoordinateBorrow<'a>, 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 helper

Trait Implementations§

Source§

impl Clone for DatabaseHelper

Source§

fn clone(&self) -> DatabaseHelper

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 DatabaseHelper

Source§

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

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

impl Default for DatabaseHelper

Source§

fn default() -> DatabaseHelper

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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>,

Source§

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>,

Source§

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> ErasedDestructor for T
where T: 'static,