Commit 2f903beb authored by Vincent Bechu's avatar Vincent Bechu Committed by Vincent Bechu

replicatestorage: make attachment sync parallel for real

parent b3950a82
......@@ -354,8 +354,8 @@
});
}
function checkAttachmentSignatureDifference(skip_attachment_dict,
queue, source,
function checkAttachmentSignatureDifference(queue, skip_attachment_dict,
source,
destination, id, name,
conflict_force,
conflict_revert,
......@@ -405,8 +405,8 @@
});
}
function checkAttachmentLocalDeletion(skip_attachment_dict,
queue, destination, id, name, source,
function checkAttachmentLocalDeletion(queue, skip_attachment_dict,
destination, id, name, source,
conflict_force, conflict_revert,
conflict_ignore) {
var status_hash;
......@@ -427,7 +427,9 @@
function pushDocumentAttachment(skip_attachment_dict, id, source,
destination, options) {
var queue = new RSVP.Queue();
var queue = new RSVP.Queue(),
local_dict = {},
signature_dict = {};
return queue
.push(function () {
......@@ -451,11 +453,10 @@
]);
})
.push(function (result_list) {
var local_dict = {},
signature_dict = {},
is_modification,
var is_modification,
is_creation,
key;
key,
argument_list = [];
for (key in result_list[0]) {
if (result_list[0].hasOwnProperty(key)) {
if (!skip_attachment_dict.hasOwnProperty(key)) {
......@@ -478,30 +479,45 @@
is_creation = !signature_dict.hasOwnProperty(key)
&& options.check_creation;
if (is_modification === true || is_creation === true) {
checkAttachmentSignatureDifference(skip_attachment_dict,
queue, source,
destination, id, key,
options.conflict_force,
options.conflict_revert,
options.conflict_ignore,
is_creation,
is_modification);
argument_list.push([undefined,
skip_attachment_dict,
source,
destination, id, key,
options.conflict_force,
options.conflict_revert,
options.conflict_ignore,
is_creation,
is_modification]);
}
}
}
return dispatchQueue(
checkAttachmentSignatureDifference,
argument_list,
context._parallel_operation_attachment_amount
);
})
.push(function () {
var key, argument_list = [];
if (options.check_deletion === true) {
for (key in signature_dict) {
if (signature_dict.hasOwnProperty(key)) {
if (!local_dict.hasOwnProperty(key)) {
checkAttachmentLocalDeletion(skip_attachment_dict,
queue, destination, id, key,
argument_list.push([undefined,
skip_attachment_dict,
destination, id, key,
source,
options.conflict_force,
options.conflict_revert,
options.conflict_ignore);
options.conflict_ignore]);
}
}
}
return dispatchQueue(
checkAttachmentLocalDeletion,
argument_list,
context._parallel_operation_attachment_amount
);
}
});
}
......@@ -1074,7 +1090,7 @@
return dispatchQueue(
repairDocument,
argument_list,
context._parallel_operation_attachment_amount
context._parallel_operation_amount
);
});
}
......
......@@ -7524,9 +7524,10 @@
console.log("get", id);
return this._sub_storage.get(id);
};
Storage2713.prototype.getAttachment = function (id) {
Storage2713.prototype.getAttachment = function () {
var storage = this,
argument_list = arguments;
argument_list = arguments,
id = argument_list[1];
start_sync[id] = true;
return ((id === "0") ? RSVP.delay(500) : RSVP.delay(100))
.then(function () {
......@@ -7586,27 +7587,18 @@
}
});
return context.jio.put("0", {"title": "foo"})
.push(function () {
return context.jio.putAttachment("0", "foo", new Blob(["0"]));
})
.push(function () {
return context.jio.put("1", {"title": "foo1"});
})
return context.jio.put("foo", {})
.push(function () {
return context.jio.putAttachment("1", "foo", new Blob(["1"]));
return context.jio.putAttachment("foo", "0", new Blob(["0"]));
})
.push(function () {
return context.jio.put("2", {"title": "foo2"});
return context.jio.putAttachment("foo", "1", new Blob(["1"]));
})
.push(function () {
return context.jio.putAttachment("2", "foo", new Blob(["2"]));
})
.push(function () {
return context.jio.put("3", {"title": "foo3"});
return context.jio.putAttachment("foo", "2", new Blob(["2"]));
})
.push(function () {
return context.jio.putAttachment("3", "foo", new Blob(["3"]));
return context.jio.putAttachment("foo", "3", new Blob(["3"]));
})
.push(function () {
return context.jio.repair();
......
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