Trait pliantdb_core::connection::Connection[][src]

pub trait Connection: Send + Sync {
#[must_use]    fn get<'life0, 'async_trait, C: Collection>(
        &'life0 self,
        id: u64
    ) -> Pin<Box<dyn Future<Output = Result<Option<Document<'static>>, Error>> + Send + 'async_trait>>
    where
        C: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn get_multiple<'life0, 'life1, 'async_trait, C: Collection>(
        &'life0 self,
        ids: &'life1 [u64]
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Document<'static>>, Error>> + Send + 'async_trait>>
    where
        C: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] #[must_use] fn query<'life0, 'async_trait, V: View>(
        &'life0 self,
        key: Option<QueryKey<V::Key>>,
        access_policy: AccessPolicy
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Map<V::Key, V::Value>>, Error>> + Send + 'async_trait>>
    where
        Self: Sized,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] #[must_use] fn query_with_docs<'life0, 'async_trait, V: View>(
        &'life0 self,
        key: Option<QueryKey<V::Key>>,
        access_policy: AccessPolicy
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MappedDocument<V::Key, V::Value>>, Error>> + Send + 'async_trait>>
    where
        Self: Sized,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] #[must_use] fn reduce<'life0, 'async_trait, V: View>(
        &'life0 self,
        key: Option<QueryKey<V::Key>>,
        access_policy: AccessPolicy
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Error>> + Send + 'async_trait>>
    where
        Self: Sized,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] #[must_use] fn reduce_grouped<'life0, 'async_trait, V: View>(
        &'life0 self,
        key: Option<QueryKey<V::Key>>,
        access_policy: AccessPolicy
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<V::Key, V::Value>>, Error>> + Send + 'async_trait>>
    where
        Self: Sized,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn apply_transaction<'life0, 'async_trait>(
        &'life0 self,
        transaction: Transaction<'static>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn list_executed_transactions<'life0, 'async_trait>(
        &'life0 self,
        starting_id: Option<u64>,
        result_limit: Option<usize>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Executed<'static>>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn last_transaction_id<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn collection<'a, C: Collection + 'static>(
        &'a self
    ) -> Collection<'a, Self, C>
    where
        Self: Sized
, { ... }
#[must_use] fn insert<'life0, 'async_trait, C: Collection>(
        &'life0 self,
        contents: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<Header, Error>> + Send + 'async_trait>>
    where
        C: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn update<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        doc: &'life1 mut Document<'life2>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        doc: &'life1 Document<'life2>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn view<V: View>(&self) -> View<'_, Self, V>
    where
        Self: Sized
, { ... } }

Defines all interactions with a schema::Schema, regardless of whether it is local or remote.

Required methods

#[must_use]fn get<'life0, 'async_trait, C: Collection>(
    &'life0 self,
    id: u64
) -> Pin<Box<dyn Future<Output = Result<Option<Document<'static>>, Error>> + Send + 'async_trait>> where
    C: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Retrieves a stored document from Collection C identified by id.

#[must_use]fn get_multiple<'life0, 'life1, 'async_trait, C: Collection>(
    &'life0 self,
    ids: &'life1 [u64]
) -> Pin<Box<dyn Future<Output = Result<Vec<Document<'static>>, Error>> + Send + 'async_trait>> where
    C: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Retrieves all documents matching ids. Documents that are not found are not returned, but no error will be generated.

#[must_use] #[must_use]fn query<'life0, 'async_trait, V: View>(
    &'life0 self,
    key: Option<QueryKey<V::Key>>,
    access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
    Self: Sized,
    V: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Queries for view entries matching View.

#[must_use] #[must_use]fn query_with_docs<'life0, 'async_trait, V: View>(
    &'life0 self,
    key: Option<QueryKey<V::Key>>,
    access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedDocument<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
    Self: Sized,
    V: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Queries for view entries matching View.

#[must_use] #[must_use]fn reduce<'life0, 'async_trait, V: View>(
    &'life0 self,
    key: Option<QueryKey<V::Key>>,
    access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<V::Value, Error>> + Send + 'async_trait>> where
    Self: Sized,
    V: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Reduces the view entries matching View.

#[must_use] #[must_use]fn reduce_grouped<'life0, 'async_trait, V: View>(
    &'life0 self,
    key: Option<QueryKey<V::Key>>,
    access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<V::Key, V::Value>>, Error>> + Send + 'async_trait>> where
    Self: Sized,
    V: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Reduces the view entries matching View, reducing the values by each unique key.

#[must_use]fn apply_transaction<'life0, 'async_trait>(
    &'life0 self,
    transaction: Transaction<'static>
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Applies a Transaction to the schema::Schema. If any operation in the Transaction fails, none of the operations will be applied to the schema::Schema.

#[must_use]fn list_executed_transactions<'life0, 'async_trait>(
    &'life0 self,
    starting_id: Option<u64>,
    result_limit: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<Executed<'static>>, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Lists executed Transactions from this schema::Schema. By default, a maximum of 1000 entries will be returned, but that limit can be overridden by setting result_limit. A hard limit of 100,000 results will be returned. To begin listing after another known transaction_id, pass transaction_id + 1 into starting_id.

#[must_use]fn last_transaction_id<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Fetches the last transaction id that has been committed, if any.

Loading content...

Provided methods

fn collection<'a, C: Collection + 'static>(&'a self) -> Collection<'a, Self, C> where
    Self: Sized
[src]

Accesses a collection for the connected schema::Schema.

#[must_use]fn insert<'life0, 'async_trait, C: Collection>(
    &'life0 self,
    contents: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<Header, Error>> + Send + 'async_trait>> where
    C: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Inserts a newly created document into the connected schema::Schema for the Collection C.

#[must_use]fn update<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    doc: &'life1 mut Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Updates an existing document in the connected schema::Schema for the Collection C. Upon success, doc.revision will be updated with the new revision.

#[must_use]fn delete<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    doc: &'life1 Document<'life2>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Removes a Document from the database.

#[must_use]fn view<V: View>(&self) -> View<'_, Self, V> where
    Self: Sized
[src]

Initializes View for schema::View V.

Loading content...

Implementors

Loading content...