Struct couchbase_lite::Replicator
source · [−]pub struct Replicator { /* private fields */ }Expand description
Replicator of database
Implementations
sourceimpl Replicator
impl Replicator
sourcepub fn new<StateCallback, DocumentsEndedCallback, ValidationF>(
db: &Database,
url: &str,
auth: &ReplicatorAuthentication,
validation_cb: ValidationF,
state_changed_callback: StateCallback,
documents_ended_callback: DocumentsEndedCallback
) -> Result<Self, Error> where
ValidationF: ReplicatorValidationFunction,
StateCallback: ReplicatorStatusChangedCallback,
DocumentsEndedCallback: ReplicatorDocumentsEndedCallback,
pub fn new<StateCallback, DocumentsEndedCallback, ValidationF>(
db: &Database,
url: &str,
auth: &ReplicatorAuthentication,
validation_cb: ValidationF,
state_changed_callback: StateCallback,
documents_ended_callback: DocumentsEndedCallback
) -> Result<Self, Error> where
ValidationF: ReplicatorValidationFunction,
StateCallback: ReplicatorStatusChangedCallback,
DocumentsEndedCallback: ReplicatorDocumentsEndedCallback,
Arguments
url- should be something like “ws://192.168.1.132:4984/demo/”validation_cb- Callback that can reject incoming revisions. Arguments: collection_name, doc_id, rev_id, rev_flags, doc_body. It should return false to reject document.state_changed_callback- reports back change of replicator statedocuments_ended_callback- reports about the replication status of documents
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
sourceimpl 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 RefUnwindSafe for Replicator
impl !Sync for Replicator
impl Unpin for Replicator
impl UnwindSafe for Replicator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more