635 revision avail in rev tree #671

Merged
merged 9 commits into from Apr 8, 2013

Conversation

Projects
None yet
2 participants
Owner

neojski commented Apr 4, 2013

We now hold every revision status (available/missing) in revision tree.

Main changes:

  • parseDoc parses status
  • doMerge is status aware
  • compaction got a little redesigned
  • get does not have to ping every document to know if it is there or got compacted (revs_info)
src/pouch.merge.js
+ } else {
+ tree1[1].status = 'missing';
+ }
+
@daleharvey

daleharvey Apr 5, 2013

Owner

Would something like:

if (tree1[1].status || tree2[1].status) { 
  tree1[1].status = (tree1[1].status === 'available' || tree2[1].status === 'available') ? 'available' : 'missing';
}

work here? it is nice to make things those options things opaque, so they only act on information they are given to them, I dont think we should be changing the tests for this change, if we merge {} {} we get {}

@neojski

neojski Apr 5, 2013

Owner

Yes, this works. I just wanted to make it explicit as we assume that this information is there and we don't want to optimize it right now. Maybe for doMerge this can be less explicit.

src/adapters/pouch.websql.js
+ tx.executeSql(sql, [JSON.stringify(metadata), docId], function(tx, result) {
+ callback();
+ }, function(tx, res){
+ console.log(res);
@daleharvey

daleharvey Apr 5, 2013

Owner

just pointing out so we remember to remove

Owner

daleharvey commented Apr 5, 2013

This is looking great, good job, few comments in there

neojski added some commits Mar 29, 2013

(#635) - compact deleted document (test)
Added test so we make sure that also deleted document get compacted
(#635) - compact deleted document as well
Now deleted document are also compacted.
(#635) - low level method document availability support
parseDoc and merge have to support new availability option
(#635) - merge_rev_tree tests now support availability
That's quite to much said as they don't check if the availability
is merged correctly.
(#635) - make merging status less explicit
If we merge statuses {} and {} we now get {} and not {status: missing}
(#635) - move more logic to generic adapter (auto_compaction)
In order auto_compaction to work I moved modification of the whole
rev_tree into compactDocument in generic adapter. It then sends
revisions which we want to delete and modified rev_tree to adapter
specific method which does the compaction process.
Owner

neojski commented Apr 5, 2013

Rebased this.

Owner

daleharvey commented Apr 8, 2013

\o/

@daleharvey daleharvey merged commit 769f782 into pouchdb:master Apr 8, 2013

1 check passed

default The Travis build passed
Details

@neojski neojski deleted the neojski:635-revision-avail-in-rev_tree branch Apr 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment