Dushistov / couchbase-lite-rust

Lightweight, embedded, syncable NoSQL database engine wrapper for Rust
Apache License 2.0
22 stars 10 forks source link

How to set the replication sync mode #103

Closed pionoor closed 1 year ago

pionoor commented 1 year ago

Hi,

We are trying to use replicator, configured to do pull sync only. In the couchbase-lite-rust crate, to init a replicator, something like:

   // Define your validation and callback functions here
    let repl = Replicator::new(
        &db,
        &sync_url,
        &auth,
        input_doc_filter,
        move |repl_state| {
            println!("replicator state changed: {repl_state:?}");
            if let ReplicatorState::Offline = repl_state {
                println!("replicator is offline");
            }
        },
        move |pushing: bool, doc_it: &mut dyn Iterator<Item = &C4DocumentEnded>| {
            for doc in doc_it {
                println!("doc: ${doc} ");
            }
        },
    );

Shouldn't there a way to configure the sync mode?

Dushistov commented 1 year ago

Shouldn't there a way to configure the sync mode?

In my use cases I always need push/pull in continues mode, so I neglected the ability to specify parameters for replicator. I will add API for pull, push mode specification.