Commit eec60f02 authored by Tristan Cavelier's avatar Tristan Cavelier

jio.js updated

parent 60eac4f9
......@@ -284,16 +284,10 @@ var storage = function (spec, my) {
that.addJob = function (method, storage_spec, doc, option, success, error) {
var command_opt = {
doc: doc,
options: option,
callbacks: {success: success, error: error}
};
if (doc) {
if (method === 'get') {
command_opt.docid = doc;
} else {
command_opt.doc = doc;
}
}
jobManager.addJob(job({
storage: priv.storage(storage_spec || {}),
command: priv.newCommand(method, command_opt)
......@@ -2302,7 +2296,8 @@ Object.defineProperty(that, "put", {
/**
* Get a document.
* @method get
* @param {string} docid The document id: "doc_id" or "doc_id/attachmt_id".
* @param {string} doc The document object. Contains at least:
* - {string} _id The document id: "doc_id" or "doc_id/attachment_id"
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {string} rev The revision we want to get.
......@@ -2318,14 +2313,14 @@ Object.defineProperty(that, "get", {
configurable: false,
enumerable: false,
writable: false,
value: function (id, options, success, error) {
value: function (doc, options, success, error) {
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 3}
);
priv.addJob(getCommand, {
docid: id,
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
......@@ -2419,19 +2414,13 @@ Object.defineProperty(that, "putAttachment", {
enumerable: false,
writable: false,
value: function (doc, options, success, error) {
var param, k, doc_with_underscores = {};
param = priv.parametersToObject(
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 0}
);
for (k in doc) {
if (doc.hasOwnProperty(k) && k.match('[^_].*')) {
doc_with_underscores["_" + k] = doc[k];
}
}
priv.addJob(putAttachmentCommand, {
doc: doc_with_underscores,
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment