pub struct Replicator { /* private fields */ }Expand description
Replicator of database
Implementations§
Source§impl Replicator
impl Replicator
Sourcepub fn new<StateCallback, DocumentsEndedCallback, ValidationF>(
db: &Database,
url: &str,
params: ReplicatorParameters<StateCallback, DocumentsEndedCallback, ValidationF>,
) -> Result<Self, Error>where
ValidationF: ReplicatorValidationFunction,
StateCallback: ReplicatorStatusChangedCallback,
DocumentsEndedCallback: ReplicatorDocumentsEndedCallback,
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
Sourcepub fn start(&mut self, reset: bool) -> Result<(), Error>
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.
Sourcepub fn restart(
self,
db: &Database,
url: &str,
auth: &ReplicatorAuthentication,
reset: bool,
) -> Result<Self, Error>
pub fn restart( self, db: &Database, url: &str, auth: &ReplicatorAuthentication, reset: bool, ) -> Result<Self, Error>
Full recreation of database replicator except callbacks,
url- new urlauth- new auth informationreset- If true, the replicator will reset its checkpoint and start replication from the beginning.
Sourcepub fn retry(&mut self) -> Result<bool, Error>
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.
pub fn stop(&mut self)
pub fn state(&self) -> ReplicatorState
Trait Implementations§
Source§impl Drop for Replicator
impl Drop for Replicator
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§
impl Freeze for Replicator
impl RefUnwindSafe for Replicator
impl !Sync for Replicator
impl Unpin for Replicator
impl UnsafeUnpin for Replicator
impl UnwindSafe for Replicator
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