Comments (9)
Can you give me a sample using the relax
method and also how you
feel the api for canceling a compacting should look like?
Also is this something you need on your code or just something you
feel we need? If it's just something you feel we need don't bother,
that's the whole point of being minimalistic. Also how many times are
you going to call that function in your code? Enough to matter if it's
in the relax
format or not?
This helps determining if it's general case enough for a minimalistic
driver. My intuition is that it is not, but I'm open to it. We all
have the common goal of making nano
awesome :)
What do you think Derek?
Would also like to see what @mikeal @daleharvey and @jhs think too.
from nano.
Our code is actually calling to replications, quite a bit. My general point is, replications take a whole host of options as part of the "body" of the potential request, continuous replication is one of many of those options, so simplifying the function call to only support one of those many operations just seems necessarily limiting.
here are some examples of common ways I use replication. You'll notice the augmentation I am proposing is around the body that we send with the request.
// replicate only two documents from db-1 to db-2
relax({
db: "_replicate",
method: "POST",
body: {
"source": "db-1",
"target": "db-2",
"doc_ids": ["doc-1","doc-2"]
}
}, fn)
// setup a filtered, continuous replication
relax({
db: "_replicate",
method: "POST"
body: {
"source": "db-1",
"target": "db-2",
"continuous": true,
"filter": "some/design/filter",
"query_params": {"key": "value"}
}
}, fn)
// cancel an existing filtered, continuous replication
relax({
db: "_replicate",
method: "POST"
body: {
"source": "db-1",
"target": "db-2",
"continuous": true,
"filter": "some/design/filter",
"query_params": {"key": "value"},
"cancel" : true
}
}, fn)
from nano.
Also, from a deprecation perspective, I believe we could assume that the continuous
argument should be either a boolean or an object.
from nano.
I see. I think that was a design error by myself actually.
You know what, we should do the opposite. Instead of creating a more specific method we should generalize the one we have.
How about:
function replicate_db(body, callback) {
return relax({db: "_replicate", body: body, method: "POST"},callback);
}
I'm ok with this change. More generic, less crap. Fine! :)
More stuff that would need to be changed:
- Change Existing Tests
- Add Cancel Replication Test
- Change docs (function signature at least)
- Bump up version number by a minimum release in
package.json
- Create and push git tag
- Publish in npm (I need to do this one)
Sounds like a good plan?
I don't know when I'll find the time to do this but feel free to send in a pull request! :)
from nano.
I could add this, I imagine this needs to be backwards compatible, yes?
from nano.
Don't worry about that for now. :)
We are pre-1.0 so interface is supposed to change. Even after 1.0 I'll
be open to small changes like this one. After the API is stable and
perfect then we will have 1.0 (and browser support) and from then on
we need to think about backward compatibility.
from nano.
Just means we need another action item.
- Add to CHANGELOG since the interface changes.
All significant additions or interface changes are supposed to go there.
from nano.
OK, I'll see if I can get to this, in the middle of some software for the day job!
from nano.
Apologies for commenting on something that is closed such a long time ago, but was this actually implemented? What is the recommended way to cancel replications?
from nano.
Related Issues (20)
- Does nano support purge? HOT 2
- db.attachment.get file- 'could not be opened because it is empty'
- Can not get correct userctx HOT 2
- Couch DB 2 compatibilty HOT 3
- bulk() with _deleted:true causes error HOT 3
- db.multipart.get does not work with Cloudant Local 1.0.0.5 HOT 1
- Enable permanent replication by writing to "_replicator" database instead of "_replicate" database. HOT 3
- Support temp view
- Doubt on db access of live app HOT 2
- What is the keys in view function based on? Is it the key you emit in the views/map function? HOT 1
- How do you update _rev to update a document?
- uploaded files displaying base64 data in the browser (attachments not viewable)
- Problem with OR -clauses? HOT 1
- Error: badarg every few hours
- Error: {error,emfile} HOT 1
- Example Lazy Creation of View
- Query string encoded when using array of keys
- Database permissions
- db.fetch array of id error
- Attempting to return simple list of documents, small issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nano.