pub trait LowLevelConnection: HasSchema + HasSession {
Show 27 methods fn apply_transaction(
        &self,
        transaction: Transaction
    ) -> Result<Vec<OperationResult>, Error>; fn get_from_collection(
        &self,
        id: DocumentId,
        collection: &CollectionName
    ) -> Result<Option<OwnedDocument>, Error>; fn get_multiple_from_collection(
        &self,
        ids: &[DocumentId],
        collection: &CollectionName
    ) -> Result<Vec<OwnedDocument>, Error>; fn list_from_collection(
        &self,
        ids: Range<DocumentId>,
        order: Sort,
        limit: Option<u32>,
        collection: &CollectionName
    ) -> Result<Vec<OwnedDocument>, Error>; fn list_headers_from_collection(
        &self,
        ids: Range<DocumentId>,
        order: Sort,
        limit: Option<u32>,
        collection: &CollectionName
    ) -> Result<Vec<Header>, Error>; fn count_from_collection(
        &self,
        ids: Range<DocumentId>,
        collection: &CollectionName
    ) -> Result<u64, Error>; fn compact_collection_by_name(
        &self,
        collection: CollectionName
    ) -> Result<(), Error>; fn query_by_name(
        &self,
        view: &ViewName,
        key: Option<SerializedQueryKey>,
        order: Sort,
        limit: Option<u32>,
        access_policy: AccessPolicy
    ) -> Result<Vec<Serialized>, Error>; fn query_by_name_with_docs(
        &self,
        view: &ViewName,
        key: Option<SerializedQueryKey>,
        order: Sort,
        limit: Option<u32>,
        access_policy: AccessPolicy
    ) -> Result<MappedSerializedDocuments, Error>; fn reduce_by_name(
        &self,
        view: &ViewName,
        key: Option<SerializedQueryKey>,
        access_policy: AccessPolicy
    ) -> Result<Vec<u8>, Error>; fn reduce_grouped_by_name(
        &self,
        view: &ViewName,
        key: Option<SerializedQueryKey>,
        access_policy: AccessPolicy
    ) -> Result<Vec<MappedSerializedValue>, Error>; fn delete_docs_by_name(
        &self,
        view: &ViewName,
        key: Option<SerializedQueryKey>,
        access_policy: AccessPolicy
    ) -> Result<u64, Error>; fn insert<C, PrimaryKey, B>(
        &self,
        id: Option<&PrimaryKey>,
        contents: B
    ) -> Result<CollectionHeader<C::PrimaryKey>, Error>
    where
        C: Collection,
        B: Into<Bytes> + Send,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + Send + ?Sized
, { ... } fn update<C: Collection, D: Document<C> + Send + Sync>(
        &self,
        doc: &mut D
    ) -> Result<(), Error> { ... } fn overwrite<C, PrimaryKey>(
        &self,
        id: &PrimaryKey,
        contents: Vec<u8>
    ) -> Result<CollectionHeader<C::PrimaryKey>, Error>
    where
        C: Collection,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey>
, { ... } fn get<C, PrimaryKey>(
        &self,
        id: &PrimaryKey
    ) -> Result<Option<OwnedDocument>, Error>
    where
        C: Collection,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + ?Sized
, { ... } fn get_multiple<'id, C, PrimaryKey, DocumentIds, I>(
        &self,
        ids: DocumentIds
    ) -> Result<Vec<OwnedDocument>, Error>
    where
        C: Collection,
        DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync,
        I: Iterator<Item = &'id PrimaryKey> + Send + Sync,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + 'id + ?Sized
, { ... } fn list<'id, C, R, PrimaryKey>(
        &self,
        ids: R,
        order: Sort,
        limit: Option<u32>
    ) -> Result<Vec<OwnedDocument>, Error>
    where
        C: Collection,
        R: Into<RangeRef<'id, C::PrimaryKey, PrimaryKey>> + Send,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + PartialEq + 'id + ?Sized,
        C::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>
, { ... } fn list_headers<'id, C, R, PrimaryKey>(
        &self,
        ids: R,
        order: Sort,
        limit: Option<u32>
    ) -> Result<Vec<Header>, Error>
    where
        C: Collection,
        R: Into<RangeRef<'id, C::PrimaryKey, PrimaryKey>> + Send,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + PartialEq + 'id + ?Sized,
        C::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>
, { ... } fn count<'id, C, R, PrimaryKey>(&self, ids: R) -> Result<u64, Error>
    where
        C: Collection,
        R: Into<RangeRef<'id, C::PrimaryKey, PrimaryKey>> + Send,
        PrimaryKey: for<'k> KeyEncoding<'k, C::PrimaryKey> + PartialEq + 'id + ?Sized,
        C::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>
, { ... } fn delete<C: Collection, H: HasHeader + Send + Sync>(
        &self,
        doc: &H
    ) -> Result<(), Error> { ... } fn query<V: SerializedView, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        order: Sort,
        limit: Option<u32>,
        access_policy: AccessPolicy
    ) -> Result<ViewMappings<V>, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>
, { ... } fn query_with_docs<V: SerializedView, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        order: Sort,
        limit: Option<u32>,
        access_policy: AccessPolicy
    ) -> Result<MappedDocuments<OwnedDocument, V>, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>
, { ... } fn query_with_collection_docs<V, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        order: Sort,
        limit: Option<u32>,
        access_policy: AccessPolicy
    ) -> Result<MappedDocuments<CollectionDocument<V::Collection>, V>, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>,
        V: SerializedView,
        V::Collection: SerializedCollection,
        <V::Collection as SerializedCollection>::Contents: Debug
, { ... } fn reduce<V: SerializedView, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        access_policy: AccessPolicy
    ) -> Result<V::Value, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>
, { ... } fn reduce_grouped<V: SerializedView, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        access_policy: AccessPolicy
    ) -> Result<GroupedReductions<V>, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>
, { ... } fn delete_docs<V: SerializedView, Key>(
        &self,
        key: Option<QueryKey<'_, V::Key, Key>>,
        access_policy: AccessPolicy
    ) -> Result<u64, Error>
    where
        Key: for<'k> KeyEncoding<'k, V::Key> + PartialEq + ?Sized,
        V::Key: Borrow<Key> + PartialEq<Key>
, { ... }
}
Expand description

The low-level interface to a database’s schema::Schema, giving access to Collections and Viewss. This trait is not safe to use within async contexts and will block the current thread. For async access, use AsyncLowLevelConnection.

This trait’s methods are not designed for ergonomics. See Connection for a higher-level interface.

Required Methods

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.

Retrieves the document with id stored within the named collection.

This is a lower-level API. For better ergonomics, consider using one of:

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:

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:

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:

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:

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

Queries for view entries from the named view.

This is a 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 Connection::view().

Queries for view entries from the named view with their source documents.

This is a 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 Connection::view().

Reduces the view entries from the named view.

This is a lower-level API. For better ergonomics, consider reducing the view using View::entries(self).reduce() instead. The parameters for the query can be customized on the builder returned from Connection::view().

Reduces the view entries from the named view, reducing the values by each unique key.

This is a lower-level API. For better ergonomics, consider reducing the view using View::entries(self).reduce_grouped() instead. The parameters for the query can be customized on the builder returned from Connection::view().

Deletes all source documents for entries that match within the named view.

This is a 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 Connection::view().

Provided Methods

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:

Updates an existing document in the connected schema::Schema for the 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:

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:

Retrieves a stored document from Collection C identified by id.

This is a lower-level API. For better ergonomics, consider using one of:

Retrieves all documents matching ids. 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:

Retrieves all documents within the range of ids. To retrieve all documents, pass in .. for ids.

This is a lower-level API. For better ergonomics, consider using one of:

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:

Counts the number of documents within the range of ids.

This is a lower-level API. For better ergonomics, consider using one of:

Removes a Document from the database.

This is a lower-level API. For better ergonomics, consider using one of:

Queries for view entries matching View.

This is a 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 SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

Queries for view entries matching View with their source documents.

This is a 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 SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

Queries for view entries matching View with their source documents, deserialized.

This is a 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 SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

Reduces the view entries matching View.

This is a lower-level API. For better ergonomics, consider reducing the view using View::entries(self).reduce() instead. The parameters for the query can be customized on the builder returned from SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

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

This is a lower-level API. For better ergonomics, consider reducing the view using View::entries(self).reduce_grouped() instead. The parameters for the query can be customized on the builder returned from SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

Deletes all of the documents associated with this view.

This is a 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 SerializedView::entries(), SerializedView::entries_async(), or Connection::view().

Implementors