Trait pliantdb::core::connection::Connection[][src]

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

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

Required methods

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

Retrieves a stored document from Collection C identified by id.

#[must_use]pub fn get_multiple<'life0, 'life1, 'async_trait, C>(
    &'life0 self,
    ids: &'life1 [u64]
) -> Pin<Box<dyn Future<Output = Result<Vec<Document<'static>, Global>, Error>> + 'async_trait + Send, Global>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait,
    C: Collection + '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]pub fn query<'life0, 'async_trait, V>(
    &'life0 self,
    key: Option<QueryKey<<V as View>::Key>>,
    access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<<V as View>::Key, <V as View>::Value>, Global>, Error>> + 'async_trait + Send, Global>> where
    'life0: 'async_trait,
    Self: 'async_trait,
    V: View + 'async_trait, 
[src]

Queries for view entries matching View.

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

Queries for view entries matching View.

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

Reduces the view entries matching View.

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

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

#[must_use]pub fn apply_transaction<'life0, 'async_trait>(
    &'life0 self,
    transaction: Transaction<'static>
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult, Global>, Error>> + 'async_trait + Send, Global>> 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]pub 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>, Global>, Error>> + 'async_trait + Send, Global>> 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]pub fn last_transaction_id<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + 'async_trait + Send, Global>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

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

Loading content...

Provided methods

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

Accesses a collection for the connected schema::Schema.

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

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

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

Removes a Document from the database.

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

Initializes View for schema::View V.

Loading content...

Implementors

impl<'a, DB> Connection for Storage<DB> where
    DB: Schema
[src]

Loading content...