Trait bonsaidb::core::connection::AsyncLowLevelConnection
source · pub trait AsyncLowLevelConnection: HasSchema + HasSession + Send + Sync {
Show 27 methods
// Required methods
fn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
id: DocumentId,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_multiple_from_collection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [DocumentId],
collection: &'life2 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn list_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list_headers_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn count_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn compact_collection_by_name<'life0, 'async_trait>(
&'life0 self,
collection: CollectionName
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn query_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Serialized>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn query_by_name_with_docs<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedSerializedDocuments, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn reduce_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn reduce_grouped_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedSerializedValue>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete_docs_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided methods
fn insert<'life0, 'life1, 'async_trait, C, PrimaryKey, B>(
&'life0 self,
id: Option<&'life1 PrimaryKey>,
contents: B
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + Send + ?Sized,
C: 'async_trait + Collection,
B: 'async_trait + Into<Bytes> + Send,
Self: 'async_trait { ... }
fn update<'life0, 'life1, 'async_trait, C, D>(
&'life0 self,
doc: &'life1 mut D
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
D: 'async_trait + Document<C> + Send + Sync,
Self: 'async_trait { ... }
fn overwrite<'a, 'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey,
contents: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait,
Self: 'async_trait { ... }
fn get<'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + ?Sized,
Self: 'async_trait { ... }
fn get_multiple<'id, 'life0, 'async_trait, C, PrimaryKey, DocumentIds, I>(
&'life0 self,
ids: DocumentIds
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync + 'async_trait,
I: Iterator<Item = &'id PrimaryKey> + Send + Sync + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + 'async_trait + ?Sized,
Self: 'async_trait { ... }
fn list<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>
where 'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait { ... }
fn list_headers<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>
where 'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait { ... }
fn count<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait { ... }
fn delete<'life0, 'life1, 'async_trait, C, H>(
&'life0 self,
doc: &'life1 H
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
H: 'async_trait + HasHeader + Send + Sync,
Self: 'async_trait { ... }
fn query<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait { ... }
fn query_with_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<OwnedDocument, V>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait { ... }
fn query_with_collection_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: SerializedView + 'async_trait,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
Self: 'async_trait { ... }
fn reduce<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<<V as View>::Value, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait { ... }
fn reduce_grouped<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait { ... }
fn delete_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait { ... }
}
Expand description
The low-level interface to a database’s schema::Schema
, giving access to
Collection
s and
Views
s. This trait is for use within async
contexts. For access outside of async contexts, use LowLevelConnection
.
This trait’s methods are not designed for ergonomics. See
AsyncConnection
for a higher-level interface.
Required Methods§
sourcefn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn apply_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction
) -> Pin<Box<dyn Future<Output = Result<Vec<OperationResult>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Applies a Transaction
to the Schema
. If any
operation in the Transaction
fails, none of the operations will be
applied to the Schema
.
sourcefn get_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
id: DocumentId,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
id: DocumentId,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieves the document with id
stored within the named collection
.
This is a lower-level API. For better ergonomics, consider using one of:
sourcefn get_multiple_from_collection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [DocumentId],
collection: &'life2 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn get_multiple_from_collection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [DocumentId],
collection: &'life2 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Retrieves all documents matching ids
from the named collection
.
Documents that are not found are not returned, but no error will be
generated.
This is a lower-level API. For better ergonomics, consider using one of:
sourcefn list_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieves all documents within the range of ids
from the named
collection
. To retrieve all documents, pass in ..
for ids
.
This is a lower-level API. For better ergonomics, consider using one of:
sourcefn list_headers_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_headers_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieves all headers within the range of ids
from the named
collection
. To retrieve all documents, pass in ..
for ids
.
This is a lower-level API. For better ergonomics, consider using one of:
sourcefn count_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn count_from_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: Range<DocumentId>,
collection: &'life1 CollectionName
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Counts the number of documents within the range of ids
from the named
collection
.
This is a lower-level API. For better ergonomics, consider using one of:
sourcefn compact_collection_by_name<'life0, 'async_trait>(
&'life0 self,
collection: CollectionName
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn compact_collection_by_name<'life0, 'async_trait>(
&'life0 self,
collection: CollectionName
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Compacts the collection to reclaim unused disk space.
This process is done by writing data to a new file and swapping the file once the process completes. This ensures that if a hardware failure, power outage, or crash occurs that the original collection data is left untouched.
Errors
Error::CollectionNotFound
: databasename
does not exist.Error::Other
: an error occurred while compacting the database.
sourcefn query_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Serialized>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn query_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<Serialized>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Queries for view entries from the named view
.
This is the lower-level API. For better ergonomics, consider querying
the view using View::entries(self).query()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn query_by_name_with_docs<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedSerializedDocuments, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn query_by_name_with_docs<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedSerializedDocuments, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Queries for view entries from the named view
with their source
documents.
This is the lower-level API. For better ergonomics, consider querying
the view using View::entries(self).query_with_docs()
instead.
The parameters for the query can be customized on the builder returned
from AsyncConnection::view()
.
sourcefn reduce_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn reduce_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Reduces the view entries from the named view
.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).reduce()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn reduce_grouped_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedSerializedValue>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn reduce_grouped_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedSerializedValue>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Reduces the view entries from the named view
, reducing the values by each
unique key.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).reduce_grouped()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn delete_docs_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_docs_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
view: &'life1 ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Deletes all source documents for entries that match within the named
view
.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).delete_docs()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
Provided Methods§
sourcefn insert<'life0, 'life1, 'async_trait, C, PrimaryKey, B>(
&'life0 self,
id: Option<&'life1 PrimaryKey>,
contents: B
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + Send + ?Sized,
C: 'async_trait + Collection,
B: 'async_trait + Into<Bytes> + Send,
Self: 'async_trait,
fn insert<'life0, 'life1, 'async_trait, C, PrimaryKey, B>(
&'life0 self,
id: Option<&'life1 PrimaryKey>,
contents: B
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + Send + ?Sized,
C: 'async_trait + Collection,
B: 'async_trait + Into<Bytes> + Send,
Self: 'async_trait,
Inserts a newly created document into the connected schema::Schema
for the Collection
C
. If id
is None
a unique id will be
generated. If an id is provided and a document already exists with that
id, a conflict error will be returned.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn update<'life0, 'life1, 'async_trait, C, D>(
&'life0 self,
doc: &'life1 mut D
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
D: 'async_trait + Document<C> + Send + Sync,
Self: 'async_trait,
fn update<'life0, 'life1, 'async_trait, C, D>(
&'life0 self,
doc: &'life1 mut D
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
D: 'async_trait + Document<C> + Send + Sync,
Self: 'async_trait,
Updates an existing document in the connected schema::Schema
for the
Collection
(schema::Collection) C
. Upon success, doc.revision
will be updated with the new revision.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn overwrite<'a, 'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey,
contents: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait,
Self: 'async_trait,
fn overwrite<'a, 'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey,
contents: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>> + Send + 'async_trait>>where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait,
Self: 'async_trait,
Overwrites an existing document, or inserts a new document. Upon success,
doc.revision
will be updated with the new revision information.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn get<'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + ?Sized,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait, C, PrimaryKey>(
&'life0 self,
id: &'life1 PrimaryKey
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: Collection + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'async_trait + ?Sized,
Self: 'async_trait,
Retrieves a stored document from Collection
C
identified by id
.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn get_multiple<'id, 'life0, 'async_trait, C, PrimaryKey, DocumentIds, I>(
&'life0 self,
ids: DocumentIds
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync + 'async_trait,
I: Iterator<Item = &'id PrimaryKey> + Send + Sync + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + 'async_trait + ?Sized,
Self: 'async_trait,
fn get_multiple<'id, 'life0, 'async_trait, C, PrimaryKey, DocumentIds, I>(
&'life0 self,
ids: DocumentIds
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync + 'async_trait,
I: Iterator<Item = &'id PrimaryKey> + Send + Sync + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + 'async_trait + ?Sized,
Self: 'async_trait,
Retrieves all documents matching ids
. Documents that are not found
are not returned, but no error will be generated.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn list<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
fn list<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedDocument>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
Retrieves all documents within the range of ids
. To retrieve all
documents, pass in ..
for ids
.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn list_headers<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
fn list_headers<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
Retrieves all documents within the range of ids
. To retrieve all
documents, pass in ..
for ids
.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn count<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
fn count<'id, 'life0, 'async_trait, C, R, PrimaryKey>(
&'life0 self,
ids: R
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'id: 'async_trait,
'life0: 'async_trait,
C: Collection + 'async_trait,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send + 'async_trait,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq + 'id + 'async_trait + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Self: 'async_trait,
Counts the number of documents within the range of ids
.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn delete<'life0, 'life1, 'async_trait, C, H>(
&'life0 self,
doc: &'life1 H
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
H: 'async_trait + HasHeader + Send + Sync,
Self: 'async_trait,
fn delete<'life0, 'life1, 'async_trait, C, H>(
&'life0 self,
doc: &'life1 H
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Collection,
H: 'async_trait + HasHeader + Send + Sync,
Self: 'async_trait,
Removes a Document
from the database.
This is the lower-level API. For better ergonomics, consider using one of:
sourcefn query<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
fn query<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
Queries for view entries matching View
(super::AsyncView).
This is the lower-level API. For better ergonomics, consider querying
the view using View::entries(self).query()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn query_with_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<OwnedDocument, V>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
fn query_with_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<OwnedDocument, V>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
Queries for view entries matching View
with their source documents.
This is the lower-level API. For better ergonomics, consider querying
the view using View::entries(self).query_with_docs()
instead.
The parameters for the query can be customized on the builder returned
from AsyncConnection::view()
.
sourcefn query_with_collection_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: SerializedView + 'async_trait,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
Self: 'async_trait,
fn query_with_collection_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: SerializedView + 'async_trait,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
Self: 'async_trait,
Queries for view entries matching View
with their source documents,
deserialized.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).query_with_collection_docs()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn reduce<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<<V as View>::Value, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
fn reduce<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<<V as View>::Value, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
Reduces the view entries matching View
.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).reduce()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn reduce_grouped<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
fn reduce_grouped<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
Reduces the view entries matching View
, reducing the values by each
unique key.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).reduce_grouped()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.
sourcefn delete_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
fn delete_docs<'life0, 'life1, 'async_trait, V, Key>(
&'life0 self,
key: Option<QueryKey<'life1, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: KeyEncoding<<V as View>::Key> + PartialEq + 'async_trait + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: 'async_trait + SerializedView,
Self: 'async_trait,
Deletes all of the documents associated with this view.
This is the lower-level API. For better ergonomics, consider querying
the view using
View::entries(self).delete_docs()
instead. The parameters for the query can be customized on the builder
returned from AsyncConnection::view()
.