Skip to main content

MemoryAdapter

Struct MemoryAdapter 

Source
pub struct MemoryAdapter { /* private fields */ }
Expand description

In-memory adapter for RouchDB. All data is held in RAM.

Implementations§

Source§

impl MemoryAdapter

Source

pub fn new(name: &str) -> Self

Trait Implementations§

Source§

impl Adapter for MemoryAdapter

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,

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,

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,

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,

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,

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,

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,

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,

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,

Retrieve raw attachment data.
Source§

fn remove_attachment<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, doc_id: &'life1 str, att_id: &'life2 str, rev: &'life3 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,

Remove an attachment from a document. Read more
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,

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,

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,

Remove a local document.
Source§

fn compact<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Compact the database: remove old revisions, clean up unreferenced attachment data.
Source§

fn destroy<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Destroy the database and all its data.
Source§

fn purge<'life0, 'async_trait>( &'life0 self, req: HashMap<String, Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<PurgeResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Purge (permanently remove) document revisions.
Source§

fn get_security<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SecurityDocument>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the security document for this database.
Source§

fn put_security<'life0, 'async_trait>( &'life0 self, doc: SecurityDocument, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the security document for this database.
Source§

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), RouchError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Close the database, releasing any held resources. Default implementation is a no-op.
Source§

impl Clone for MemoryAdapter

Source§

fn clone(&self) -> MemoryAdapter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryAdapter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.