MemoryPersister

Struct MemoryPersister 

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

For Testing An in-memory persister.

As this provides no actual persistence it should not be used for any real application, it actually reduces performance of the plain backend slightly due to tracking the changes itself.

Trait Implementations§

Source§

impl Debug for MemoryPersister

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryPersister

Source§

fn default() -> MemoryPersister

Returns the “default value” for a type. Read more
Source§

impl Persister for MemoryPersister

Source§

fn get_changes(&self) -> Result<Vec<Vec<u8>>, Self::Error>

Get the changes out of the map.

Source§

fn insert_changes( &mut self, changes: Vec<(ActorId, u64, Vec<u8>)>, ) -> Result<(), Self::Error>

Insert changes into the map.

Source§

fn remove_changes( &mut self, changes: Vec<(&ActorId, u64)>, ) -> Result<(), Self::Error>

Remove changes from the map.

Source§

fn get_document(&self) -> Result<Option<Vec<u8>>, Self::Error>

Get the document.

Source§

fn set_document(&mut self, data: Vec<u8>) -> Result<(), Self::Error>

Set the document.

Source§

type Error = Infallible

The error type that the operations can produce
Source§

fn get_sync_state(&self, peer_id: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>

Returns the sync state for the given peer if one exists. Read more
Source§

fn set_sync_state( &mut self, peer_id: Vec<u8>, sync_state: Vec<u8>, ) -> Result<(), Self::Error>

Sets the sync state for the given peer. Read more
Source§

fn remove_sync_states(&mut self, peer_ids: &[&[u8]]) -> Result<(), Self::Error>

Removes the sync states associated with the given peer_ids.
Source§

fn get_peer_ids(&self) -> Result<Vec<Vec<u8>>, Self::Error>

Returns the list of peer ids with stored SyncStates. Read more
Source§

fn sizes(&self) -> StoredSizes

Returns the sizes components being stored consume. Read more
Source§

fn flush(&mut self) -> Result<usize, Self::Error>

Flush the data out to disk.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more