Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:couchbaselabs/TouchDB-Android

  • Loading branch information...
commit ebffc8a48537990c37ace7c799417ca201af71d7 2 parents 0a6f826 + 12754b8
@mschoch mschoch authored
View
1  TouchDB-Android/src/com/couchbase/touchdb/TDDatabase.java
@@ -206,6 +206,7 @@ public boolean replaceWithDatabase(String databasePath, String attachmentsPath)
FileDirUtils.copyFile(sourceFile, destFile);
File attachmentsFile = new File(dstAttachmentsPath);
FileDirUtils.deleteRecursive(attachmentsFile);
+ attachmentsFile.mkdirs();
if(attachmentsPath != null) {
FileDirUtils.copyFolder(new File(attachmentsPath), attachmentsFile);
}
View
14 TouchDB-Android/src/com/couchbase/touchdb/replicator/TDPuller.java
@@ -125,7 +125,7 @@ public void changeTrackerReceivedChange(Map<String, Object> change) {
rev.setSequence(++nextFakeSequence);
addToInbox(rev);
}
- changesTotal+= changes.size();
+ setChangesTotal(getChangesTotal() + changes.size());
}
@Override
@@ -158,7 +158,7 @@ public void processInbox(TDRevisionList inbox) {
// Ask the local database which of the revs are not known to it:
//Log.w(TDDatabase.TAG, String.format("%s: Looking up %s", this, inbox));
String lastInboxSequence = ((TDPulledRevision)inbox.get(inbox.size()-1)).getRemoteSequenceID();
- int total = changesTotal - inbox.size();
+ int total = getChangesTotal() - inbox.size();
if(!db.findMissingRevisions(inbox)) {
Log.w(TDDatabase.TAG, String.format("%s failed to look up local revs", this));
inbox = null;
@@ -168,8 +168,8 @@ public void processInbox(TDRevisionList inbox) {
if(inbox != null) {
inboxCount = inbox.size();
}
- if(changesTotal != total + inboxCount) {
- changesTotal = total + inboxCount;
+ if(getChangesTotal() != total + inboxCount) {
+ setChangesTotal(total + inboxCount);
}
if(inboxCount == 0) {
@@ -260,13 +260,13 @@ public void onCompletion(Object result, Throwable e) {
asyncTaskStarted();
} else {
Log.w(TDDatabase.TAG, this + ": Missing revision history in response from " + pathInside);
- changesProcessed++;
+ setChangesProcessed(getChangesProcessed() + 1);
}
} else {
if(e != null) {
error = e;
}
- changesProcessed++;
+ setChangesProcessed(getChangesProcessed() + 1);
}
// Note that we've finished this task; then start another one if there
@@ -343,7 +343,7 @@ public int compare(List<Object> list1, List<Object> list2) {
asyncTaskFinished(revs.size());
}
- changesProcessed += revs.size();
+ setChangesProcessed(getChangesProcessed() + revs.size());
}
List<String> knownCurrentRevIDs(TDRevision rev) {
View
4 TouchDB-Android/src/com/couchbase/touchdb/replicator/TDPusher.java
@@ -209,7 +209,7 @@ public void onCompletion(Object response, Throwable e) {
bulkDocsBody.put("new_edits", false);
Log.i(TDDatabase.TAG, String.format("%s: Sending %d revisions", this, numDocsToSend));
Log.v(TDDatabase.TAG, String.format("%s: Sending %s", this, inbox));
- changesTotal += numDocsToSend;
+ setChangesTotal(getChangesTotal() + numDocsToSend);
asyncTaskStarted();
sendAsyncRequest("POST", "/_bulk_docs", bulkDocsBody, new TDRemoteRequestCompletionBlock() {
@@ -221,7 +221,7 @@ public void onCompletion(Object result, Throwable e) {
Log.v(TDDatabase.TAG, String.format("%s: Sent %s", this, inbox));
setLastSequence(String.format("%d", lastInboxSequence));
}
- changesProcessed += numDocsToSend;
+ setChangesProcessed(getChangesProcessed() + numDocsToSend);
asyncTaskFinished(1);
}
});
View
4 TouchDB-Android/src/com/couchbase/touchdb/replicator/TDReplicator.java
@@ -43,8 +43,8 @@
protected String sessionID;
protected TDBatcher<TDRevision> batcher;
protected int asyncTaskCount;
- protected int changesProcessed;
- protected int changesTotal;
+ private int changesProcessed;
+ private int changesTotal;
protected final HttpClientFactory clientFacotry;
protected String filterName;
protected Map<String,Object> filterParams;
View
2  TouchDB-Android/src/com/couchbase/touchdb/replicator/changetracker/TDChangeTracker.java
@@ -229,7 +229,7 @@ public void process(HttpRequest request,
}
}
}
- Log.v(TDDatabase.TAG, "Chagne tracker run loop exiting");
+ Log.v(TDDatabase.TAG, "Change tracker run loop exiting");
}
public boolean receivedChunk(String line) {
Please sign in to comment.
Something went wrong with that request. Please try again.