gpt4 book ai didi

android - Couchbase Lite 到 CouchDB 的复制——没有数据

转载 作者:行者123 更新时间:2023-11-30 02:13:43 25 4
gpt4 key购买 nike

我目前在 Android 应用程序上使用 CouchbaseLite,我刚刚开始使用复制功能同步到 couchdb 数据库(我是新手)。

这就是问题所在,我已按照概述的所有步骤进行操作 here

我的复制对象向我发送空闲状态。但是我指向的特定 couchdb 数据库中没有数据。有什么我想念的吗?

URL url = new URL("http://192.168.1.100:5984/data/");
push = database.createPushReplication(url);
pull = database.createPullReplication(url);
pull.setContinuous(true);
push.setContinuous(true);
BasicAuthenticator authenticator = new BasicAuthenticator("olabode", "couch");
pull.setAuthenticator(authenticator);
push.setAuthenticator(authenticator);

pull.addChangeListener(this);
push.addChangeListener(this);

push.setFilter("addStoreNameFilter");
pull.setFilter("pullCurrentStoreFilter");

// Start
push.start();
pull.start();

database.setFilter("addStoreNameFilter", new ReplicationFilter() {
@Override
public boolean filter(SavedRevision savedRevision, Map<String, Object> map) {
map.put(Dao.STORE_ID, storeId);
return true;
}
});

database.setFilter("pullCurrentStoreFilter", new ReplicationFilter() {
@Override
public boolean filter(SavedRevision savedRevision, Map<String, Object> map) {
String currentStoreId = (String) map.get(Dao.STORE_ID);
if (currentStoreId == storeId)
return true;

return false;
}
});

请帮忙!

最佳答案

您使用连续复制。

pull.setContinuous(true);
push.setContinuous(true);

在这种情况下,Idle 状态就可以了。

Idle: Indicates that a continuous replication has "caught up" and transferred all documents, but is monitoring the source database for future changes.

Observing and monitoring replications

关于android - Couchbase Lite 到 CouchDB 的复制——没有数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29731546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com