pub struct HttpAdapter { /* private fields */ }Expand description
HTTP adapter that talks to a remote CouchDB instance.
Implementations§
Source§impl HttpAdapter
impl HttpAdapter
Sourcepub fn new(url: &str) -> Self
pub fn new(url: &str) -> Self
Create a new HTTP adapter pointing at a CouchDB database URL.
The URL should include the database name, e.g.
http://localhost:5984/mydb or http://admin:password@localhost:5984/mydb
Sourcepub fn with_client(url: &str, client: Client) -> Self
pub fn with_client(url: &str, client: Client) -> Self
Create a new HTTP adapter with a custom reqwest client.
Trait Implementations§
Source§impl Adapter for HttpAdapter
impl Adapter for HttpAdapter
Source§fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get database information: name, document count, update sequence.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
opts: GetOptions,
) -> Pin<Box<dyn Future<Output = Result<Document>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
opts: GetOptions,
) -> Pin<Box<dyn Future<Output = Result<Document>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a single document by ID. Read more
Source§fn bulk_docs<'life0, 'async_trait>(
&'life0 self,
docs: Vec<Document>,
opts: BulkDocsOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn bulk_docs<'life0, 'async_trait>(
&'life0 self,
docs: Vec<Document>,
opts: BulkDocsOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write multiple documents atomically. Read more
Source§fn all_docs<'life0, 'async_trait>(
&'life0 self,
opts: AllDocsOptions,
) -> Pin<Box<dyn Future<Output = Result<AllDocsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn all_docs<'life0, 'async_trait>(
&'life0 self,
opts: AllDocsOptions,
) -> Pin<Box<dyn Future<Output = Result<AllDocsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Query all documents, optionally filtered by key range.
Source§fn changes<'life0, 'async_trait>(
&'life0 self,
opts: ChangesOptions,
) -> Pin<Box<dyn Future<Output = Result<ChangesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn changes<'life0, 'async_trait>(
&'life0 self,
opts: ChangesOptions,
) -> Pin<Box<dyn Future<Output = Result<ChangesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get changes since a given sequence number.
Source§fn revs_diff<'life0, 'async_trait>(
&'life0 self,
revs: HashMap<String, Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<RevsDiffResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revs_diff<'life0, 'async_trait>(
&'life0 self,
revs: HashMap<String, Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<RevsDiffResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Compare sets of document revisions to find which ones the adapter
is missing. Used during replication to avoid transferring data the
target already has.
Source§fn bulk_get<'life0, 'async_trait>(
&'life0 self,
docs: Vec<BulkGetItem>,
) -> Pin<Box<dyn Future<Output = Result<BulkGetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn bulk_get<'life0, 'async_trait>(
&'life0 self,
docs: Vec<BulkGetItem>,
) -> Pin<Box<dyn Future<Output = Result<BulkGetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch multiple documents by ID and revision in a single request.
Used during replication to efficiently retrieve missing documents.
Source§fn put_attachment<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
att_id: &'life2 str,
rev: &'life3 str,
data: Vec<u8>,
content_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<DocResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn put_attachment<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
att_id: &'life2 str,
rev: &'life3 str,
data: Vec<u8>,
content_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<DocResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Store an attachment on a document.
Source§fn get_attachment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
att_id: &'life2 str,
opts: GetAttachmentOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_attachment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
att_id: &'life2 str,
opts: GetAttachmentOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve raw attachment data.
Source§fn get_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a local document (not replicated, used for checkpoints).
Source§fn put_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
doc: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
doc: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write a local document (not replicated, used for checkpoints).
Source§fn remove_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_local<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a local document.
Auto Trait Implementations§
impl Freeze for HttpAdapter
impl !RefUnwindSafe for HttpAdapter
impl Send for HttpAdapter
impl Sync for HttpAdapter
impl Unpin for HttpAdapter
impl !UnwindSafe for HttpAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more