Commit 0cb41c37 authored by Vincent Bechu's avatar Vincent Bechu

replicatestorage: signature storage database prop is storage hash

parent 754e5df9
...@@ -55,11 +55,16 @@ ...@@ -55,11 +55,16 @@
stringify(spec.remote_sub_storage) + stringify(spec.remote_sub_storage) +
stringify(this._query_options) stringify(this._query_options)
); );
this._signature_sub_storage = jIO.createJIO({ if (spec.signature_storage !== undefined) {
type: "document", spec.signature_storage.database = this._signature_hash;
document_id: this._signature_hash, this._signature_sub_storage = jIO.createJIO(spec.signature_storage);
sub_storage: spec.signature_storage || spec.local_sub_storage } else {
}); this._signature_sub_storage = jIO.createJIO({
type: "document",
document_id: this._signature_hash,
sub_storage: spec.local_sub_storage
});
}
this._use_remote_post = spec.use_remote_post || false; this._use_remote_post = spec.use_remote_post || false;
// Number of request we allow browser execution for attachments // Number of request we allow browser execution for attachments
...@@ -983,9 +988,12 @@ ...@@ -983,9 +988,12 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
// Ensure that the document storage is usable // Ensure that the document storage is usable
return context._signature_sub_storage.__storage._sub_storage.get( if (context._signature_sub_storage.__type === "document") {
context._signature_hash return context._signature_sub_storage.__storage._sub_storage.get(
); context._signature_hash
);
}
return;
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if ((error instanceof jIO.util.jIOError) && if ((error instanceof jIO.util.jIOError) &&
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
equal(jio.__storage._check_remote_attachment_deletion, true); equal(jio.__storage._check_remote_attachment_deletion, true);
equal(jio.__storage._check_remote_attachment_modification, true); equal(jio.__storage._check_remote_attachment_modification, true);
equal(jio.__storage._signature_sub_storage.__storage._sub_storage.__type, equal(jio.__storage._signature_sub_storage.__type,
"signaturestorage2713"); "signaturestorage2713");
equal(jio.__storage._signature_hash, equal(jio.__storage._signature_hash,
"_replicate_11881e431308c0ec8c0e6430be98db380e1b92f8"); "_replicate_11881e431308c0ec8c0e6430be98db380e1b92f8");
...@@ -4649,6 +4649,34 @@ ...@@ -4649,6 +4649,34 @@
}); });
}); });
test("signature storage database named as hash", function () {
var jio = jIO.createJIO({
type: "replicate",
signature_storage: {
type: "indexeddb"
},
local_sub_storage: {
type: "uuid",
sub_storage: {
type: "memory"
}
},
remote_sub_storage: {
type: "uuid",
sub_storage: {
type: "memory"
}
}
});
equal(
"jio:_replicate_b9296354cdf1dbe0046de11f57a5a24f8f6a78a8",
jio.__storage._signature_sub_storage.__storage._database_name,
"database equal hash"
);
});
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// attachment replication // attachment replication
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
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