Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add API for continuous replications #36

Open
gr2m opened this issue Feb 3, 2014 · 12 comments
Open

add API for continuous replications #36

gr2m opened this issue Feb 3, 2014 · 12 comments

Comments

@gr2m
Copy link
Contributor

gr2m commented Feb 3, 2014

I need to create a plugin that syncs all data across all user accounts being created. My idea is to use continuous replications for that. I need filtered replications, as only data shall be synchronised, not tasks.

It's somewhat urgent, so if there is any idea on how to get this working quickly (don't mind dirty), I'm all in for it.

So here's some dream API

var userDb = hoodie.database(userDbName);
var groupDb = hoodie.database(groupDbName);

// create continuous filtered replication userDb => groupDb
groupDb.subscribe(userDb, {filter: filterFunction}, handler);

// create continuous replication groupDb => userDb
userDb.subscribe(groupDb, handler);

// remove replication
userDb.unsubscribe(groupDb, handler);

// continuous replications (aka subscriptions) shall be removed automatically when user accounts get removed.
@gr2m
Copy link
Contributor Author

gr2m commented Feb 3, 2014

@janl @caolan @svnlto

@janl
Copy link
Contributor

janl commented Feb 4, 2014

assuming low numbers of users this should be fine.

On 03 Feb 2014, at 21:36 , Gregor Martynus [email protected] wrote:

@janl @caolan @svnlto


Reply to this email directly or view it on GitHub.

@caolan
Copy link
Contributor

caolan commented Feb 4, 2014

I'm assuming filterFunction is the actual function, not the name of a function in a design doc?

@gr2m
Copy link
Contributor Author

gr2m commented Feb 4, 2014

yes, it's the actual function, would make things so much easier for devs

@caolan
Copy link
Contributor

caolan commented Feb 4, 2014

and as @janl says for a low number of users this should be workable using the replicator db in couch.

@gr2m
Copy link
Contributor Author

gr2m commented Feb 4, 2014

for the case I need this for, there won't be more than 20 users per installation I guess

@janl
Copy link
Contributor

janl commented Feb 4, 2014

yeah, this is totally fine then. I can build this

@janl
Copy link
Contributor

janl commented Mar 28, 2014

Related, we should have a replication API that encapsulates a few hoodie specific things like naming conventions, e.g. https://github.com/hoodiehq/hoodie-plugin-global-share/blob/master/worker.js#L376-L393 so plugins get a simple API for setting these things up.

@caolan
Copy link
Contributor

caolan commented Mar 28, 2014

@janl not sure I follow that last comment, how do these things affect replication?

@janl
Copy link
Contributor

janl commented Mar 28, 2014

@caolan sorry for being dense, doing a brain dump of various things here :)

writing hoodie-plugin-global-shares currently requires intimate knowledge of hoodie conventions (as shown here https://github.com/hoodiehq/hoodie-plugin-global-share/blob/master/worker.js#L376-L393). It would be nice if it would be possible to write this plugins and plugins like it without having to understand the intricate Hoodie-specific naming of databases, documents and properties.

@janl
Copy link
Contributor

janl commented Mar 28, 2014

(maybe I should open a new issue for this, it just felt related)

@caolan
Copy link
Contributor

caolan commented Mar 28, 2014

@janl yep, we should tidy that up. Open to API suggestions here.

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

No branches or pull requests

3 participants