Replicator

Struct Replicator 

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

Replicator of database

Implementations§

Source§

impl Replicator

Source

pub fn new<StateCallback, DocumentsEndedCallback, ValidationF>( db: &Database, url: &str, params: ReplicatorParameters<StateCallback, DocumentsEndedCallback, ValidationF>, ) -> Result<Self, Error>
where ValidationF: ReplicatorValidationFunction, StateCallback: ReplicatorStatusChangedCallback, DocumentsEndedCallback: ReplicatorDocumentsEndedCallback,

§Arguments
  • url - should be something like “ws://192.168.1.132:4984/demo/”
  • params - parameters of replicator
Source

pub fn start(&mut self, reset: bool) -> Result<(), Error>

starts database replication

  • reset - If true, the replicator will reset its checkpoint and start replication from the beginning.
Source

pub fn restart( self, db: &Database, url: &str, auth: &ReplicatorAuthentication, reset: bool, ) -> Result<Self, Error>

Full recreation of database replicator except callbacks,

  • url - new url
  • auth - new auth information
  • reset - If true, the replicator will reset its checkpoint and start replication from the beginning.
Source

pub fn retry(&mut self) -> Result<bool, Error>

Tells a replicator that’s in the offline state to reconnect immediately. return true if the replicator will reconnect, false if it won’t.

Source

pub fn stop(&mut self)

Source

pub fn state(&self) -> ReplicatorState

Trait Implementations§

Source§

impl Drop for Replicator

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Replicator

it should be safe to call replicator API from any thread according to https://github.com/couchbase/couchbase-lite-core/wiki/Thread-Safety

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, 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V