-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
This is a Work in Progress
If I run jawn.diff(feedOneId, feedTwoId) I should get a stream of json objects representing actions (add/update/delete).
If I apply all of the actions in that stream to the database/repository represented by feedOne, its contents should then match feedTwo.
Running a diff
Checkout a feed, run a diff and print the results of the diff.
var jawn = require('jawn');
var through = require('through2').obj;
var checkout = jawn.checkout(feedOneId);
checkout.on('end', function () {
jawn.diff(feedOneId, feedTwoId).pipe(process.stdout)
});The output should look roughly like this: (see 2015 dat beta for real examples)
{ action: "add", key: 9812349878, values: {...} }
{ action: "delete", key: 23421341234 }
Applying a diff using (hypothetical) jawn.applyActionStream function
var jawn = require('jawn');
var through = require('through2').obj;
var checkout = jawn.checkout(feedOneId);
var applyActions = jawn.applyActionStream
checkout.on('end', function () {
jawn.diff(feedOneId, feedTwoId).pipe(applyActions)
})
applyActions.on('end', function () {
// the current contents of the repo should match the contents of feedTwo
t.same('', jawn.diff(jawn.current, feedTwoId))
})Metadata
Metadata
Assignees
Labels
No labels