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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V