Commit c28b6cf6 authored by Romain Courteaud's avatar Romain Courteaud

Release Version 3.19.0

ReplicateStorage: fix some attachment replication issues
parent 3b3ed84b
......@@ -9116,6 +9116,13 @@ return new Parser;
});
} else {
result
.push(function () {
// Drop signature if the destination document was empty
// but a signature exists
if (options.create_new_document === true) {
return context._signature_sub_storage.remove(id);
}
})
.push(function () {
return destination.put(id, doc);
})
......@@ -9229,7 +9236,11 @@ return new Parser;
return propagateModification(context, source, destination, doc,
local_hash, id, skip_document_dict,
{use_post: ((options.use_post) &&
(remote_hash === null))});
(remote_hash === null)),
create_new_document:
((remote_hash === null) &&
(status_hash !== null))
});
}
// Conflict cases
......@@ -9252,7 +9263,9 @@ return new Parser;
id,
skip_document_dict,
{use_post: ((options.use_revert_post) &&
(local_hash === null))}
(local_hash === null)),
create_new_document: ((local_hash === null) &&
(status_hash !== null))}
);
}
......@@ -9261,7 +9274,9 @@ return new Parser;
// Copy remote modification remotely
return propagateModification(context, source, destination, doc,
local_hash, id, skip_document_dict,
{use_post: options.use_post});
{use_post: options.use_post,
create_new_document:
(status_hash !== null)});
}
doc = doc || local_hash;
remote_doc = remote_doc || remote_hash;
......@@ -9328,6 +9343,7 @@ return new Parser;
}
function pushStorage(context, skip_document_dict,
skip_deleted_document_dict,
cache, source_key, destination_key,
source, destination, signature_allDocs, options) {
var argument_list = [],
......@@ -9422,10 +9438,10 @@ return new Parser;
options.operation_amount
);
});
if (options.check_deletion === true) {
for (key in signature_dict) {
if (signature_dict.hasOwnProperty(key)) {
if (!local_dict.hasOwnProperty(key)) {
for (key in signature_dict) {
if (signature_dict.hasOwnProperty(key)) {
if (!local_dict.hasOwnProperty(key)) {
if (options.check_deletion === true) {
argument_list_deletion.push([undefined,
context,
skip_document_dict,
......@@ -9436,9 +9452,13 @@ return new Parser;
options.conflict_revert,
options.conflict_ignore,
options]);
} else {
skip_deleted_document_dict[key] = null;
}
}
}
}
if (argument_list_deletion.length !== 0) {
queue.push(function () {
return dispatchQueue(
context,
......@@ -9462,6 +9482,7 @@ return new Parser;
var context = this,
argument_list = arguments,
skip_document_dict = {},
skip_deleted_document_dict = {},
cache = {};
return new RSVP.Queue()
......@@ -9525,6 +9546,7 @@ return new Parser;
context._check_local_creation ||
context._check_local_deletion) {
return pushStorage(context, skip_document_dict,
skip_deleted_document_dict,
cache, 'local', 'remote',
context._local_sub_storage,
context._remote_sub_storage,
......@@ -9554,6 +9576,7 @@ return new Parser;
context._check_remote_creation ||
context._check_remote_deletion) {
return pushStorage(context, skip_document_dict,
skip_deleted_document_dict,
cache, 'remote', 'local',
context._remote_sub_storage,
context._local_sub_storage,
......@@ -9586,12 +9609,19 @@ return new Parser;
.push(function (result) {
var i,
local_argument_list = [],
id,
len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
local_argument_list.push(
[undefined, context, result.data.rows[i].id]
);
id = result.data.rows[i].id;
// Do not synchronize attachment if one version of the document
// is deleted but not pushed to the other storage
if (!skip_deleted_document_dict.hasOwnProperty(id) ||
skip_document_dict.hasOwnProperty(id)) {
local_argument_list.push(
[undefined, context, id]
);
}
}
return dispatchQueue(
context,
......@@ -12643,14 +12673,18 @@ return new Parser;
});
};
function handleGet(request, resolve, reject) {
function handleGet(store, id, resolve, reject) {
var request = store.get(id);
request.onerror = reject;
request.onsuccess = function () {
if (request.result) {
resolve(request.result);
} else {
// XXX How to get ID
reject(new jIO.util.jIOError("Cannot find document", 404));
reject(new jIO.util.jIOError(
"IndexedDB: cannot find object '" + id + "' in the '" +
store.name + "' store",
404
));
}
};
}
......@@ -12661,7 +12695,8 @@ return new Parser;
return new RSVP.Promise(function (resolve, reject) {
var transaction = openTransaction(db, ["metadata"], "readonly");
handleGet(
transaction.objectStore("metadata").get(id),
transaction.objectStore("metadata"),
id,
resolve,
reject
);
......@@ -12694,7 +12729,8 @@ return new Parser;
);
}
handleGet(
transaction.objectStore("metadata").get(id),
transaction.objectStore("metadata"),
id,
getAttachments,
reject
);
......@@ -12822,7 +12858,8 @@ return new Parser;
result_list.push(result);
}
i += 1;
handleGet(store.get(buildKeyPath([id, name, i])),
handleGet(store,
buildKeyPath([id, name, i]),
(i <= end_index) ? getPart(i) : resolver,
reject
);
......@@ -12831,8 +12868,8 @@ return new Parser;
getPart(start_index - 1)();
}
// XXX Should raise if key is not good
handleGet(transaction.objectStore("attachment")
.get(buildKeyPath([id, name])),
handleGet(transaction.objectStore("attachment"),
buildKeyPath([id, name]),
getBlob,
reject
);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "jio",
"version": "v3.18.0",
"version": "v3.19.0",
"license": "LGPLv3",
"author": "Nexedi SA",
"contributors": [
......
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