Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

(#204) - Follow db updates #205

Merged
merged 1 commit into from Jun 5, 2014
Merged

Conversation

jo
Copy link
Contributor

@jo jo commented May 28, 2014

nano.follow_updates([params], [callback])

uses follow to create a solid _db_updates feed. please consult follow
documentation for more information as this is a very complete api on it's own

var feed = nano.follow_updates({since: "now"});
feed.on('change', function (change) {
  console.log("change: ", change);
});
feed.follow();
process.nextTick(function () {
  nano.db.create('alice');
});

@dscape
Copy link
Contributor

dscape commented May 30, 2014

Sorry I'm confused, why is this more than just updating the following dependency? I don't see any deleted code.

Thanks for the code, looking forward to understanding this a bit better

@jo
Copy link
Contributor Author

jo commented May 30, 2014

Sorry if my explenation was not clear - I have added nano.follow which is similar to nano.db.follow but uses Follow to keep up with _db_updates instead of _changes.

@dscape
Copy link
Contributor

dscape commented May 30, 2014

Ok. If that's the case please de-duplicate the code and make sure they use the same helper function, but with the different URL. I'm ok with the API change but duplicated code makes it complicated (as noted by my remarks)

Thanks 💯

@dscape
Copy link
Contributor

dscape commented May 30, 2014

Also 📖 docs !

@jo
Copy link
Contributor Author

jo commented May 30, 2014

Oh f* I forgot the docs.
And sure I will dry the code, good point!

@jo
Copy link
Contributor Author

jo commented May 30, 2014

Here again, squashed, with docs.
The code now makes - forgive me my previous foolishness - use of the follow_db function, without the useless duplication.

@dscape
Copy link
Contributor

dscape commented May 30, 2014

Looks good. Are you sure you want to name it follow? Maybe db_updates instead?

Other than that, good to merge

@jo
Copy link
Contributor Author

jo commented May 30, 2014

We have nano.db.changes and nano.db.follow and so I think its most consistent to call it nano.updates and nano.follow.

@jo
Copy link
Contributor Author

jo commented May 30, 2014

What about follow_db_updates and also renaming updates into db_updates for ultimate clarity?

@jo
Copy link
Contributor Author

jo commented Jun 5, 2014

Lets call it follow_updates and leave updates ok?

@jo
Copy link
Contributor Author

jo commented Jun 5, 2014

Did the name change in code, commit msg as well as in issue and PR descriptions.
I think its ready to merge now.

@jo
Copy link
Contributor Author

jo commented Jun 5, 2014

... and fixed the tests for updates: They have been failed after the switch which checks for _db_updates support if there was support.

`nano.follow_updates([params], [callback])`

uses follow to create a solid `_db_updates` feed. please consult follow
documentation for more information as this is a very complete api on it's own

```js
var feed = nano.follow_updates({since: "now"});
feed.on('change', function (change) {
  console.log("change: ", change);
});
feed.follow();
process.nextTick(function () {
  nano.db.create('alice');
});
```
dscape added a commit that referenced this pull request Jun 5, 2014
@dscape dscape merged commit 512b3e5 into apache:master Jun 5, 2014
@dscape
Copy link
Contributor

dscape commented Jun 5, 2014

merged :) publish?

@jo
Copy link
Contributor Author

jo commented Jun 5, 2014

Thanks and yes please publish ;-)

@dscape
Copy link
Contributor

dscape commented Jun 5, 2014

done :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants