Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
jio_mebibou
Commits
40ef31b0
Commit
40ef31b0
authored
Apr 11, 2017
by
Vincent Bechu
Committed by
Romain Courteaud
May 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplicateStorage: allow to manually define the signature storage
parent
ae47ebe7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
25 deletions
+62
-25
src/jio.storage/replicatestorage.js
src/jio.storage/replicatestorage.js
+28
-20
test/jio.storage/replicatestorage.tests.js
test/jio.storage/replicatestorage.tests.js
+34
-5
No files found.
src/jio.storage/replicatestorage.js
View file @
40ef31b0
...
...
@@ -50,19 +50,25 @@
this
.
_local_sub_storage
=
jIO
.
createJIO
(
spec
.
local_sub_storage
);
this
.
_remote_sub_storage
=
jIO
.
createJIO
(
spec
.
remote_sub_storage
);
this
.
_signature_hash
=
"
_replicate_
"
+
generateHash
(
stringify
(
spec
.
local_sub_storage
)
+
stringify
(
spec
.
remote_sub_storage
)
+
stringify
(
this
.
_query_options
)
);
this
.
_signature_sub_storage
=
jIO
.
createJIO
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
document
"
,
document_id
:
this
.
_signature_hash
,
sub_storage
:
spec
.
signature_storage
||
spec
.
local_sub_storage
}
});
if
(
spec
.
hasOwnProperty
(
'
signature_sub_storage
'
))
{
this
.
_signature_sub_storage
=
jIO
.
createJIO
(
spec
.
signature_sub_storage
);
this
.
_custom_signature_sub_storage
=
true
;
}
else
{
this
.
_signature_hash
=
"
_replicate_
"
+
generateHash
(
stringify
(
spec
.
local_sub_storage
)
+
stringify
(
spec
.
remote_sub_storage
)
+
stringify
(
this
.
_query_options
)
);
this
.
_signature_sub_storage
=
jIO
.
createJIO
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
document
"
,
document_id
:
this
.
_signature_hash
,
sub_storage
:
spec
.
local_sub_storage
}
});
this
.
_custom_signature_sub_storage
=
false
;
}
this
.
_use_remote_post
=
spec
.
use_remote_post
||
false
;
// Number of request we allow browser execution for attachments
...
...
@@ -937,16 +943,18 @@
argument_list
=
arguments
,
skip_document_dict
=
{};
// Do not sync the signature document
skip_document_dict
[
context
.
_signature_hash
]
=
null
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// Ensure that the document storage is usable
return
context
.
_signature_sub_storage
.
__storage
.
_sub_storage
.
__storage
.
_sub_storage
.
get
(
context
.
_signature_hash
);
if
(
context
.
_custom_signature_sub_storage
===
false
)
{
// Do not sync the signature document
skip_document_dict
[
context
.
_signature_hash
]
=
null
;
return
context
.
_signature_sub_storage
.
__storage
.
_sub_storage
.
__storage
.
_sub_storage
.
get
(
context
.
_signature_hash
);
}
})
.
push
(
undefined
,
function
(
error
)
{
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
...
...
test/jio.storage/replicatestorage.tests.js
View file @
40ef31b0
...
...
@@ -74,6 +74,7 @@
equal
(
jio
.
__storage
.
_check_remote_attachment_deletion
,
false
);
equal
(
jio
.
__storage
.
_check_remote_attachment_modification
,
false
);
equal
(
jio
.
__storage
.
_custom_signature_sub_storage
,
false
);
equal
(
jio
.
__storage
.
_signature_hash
,
"
_replicate_7209dfbcaff00f6637f939fdd71fa896793ed385
"
);
...
...
@@ -110,9 +111,6 @@
remote_sub_storage
:
{
type
:
"
replicatestorage500
"
},
signature_storage
:
{
type
:
"
signaturestorage2713
"
},
query
:
{
query
:
'
portal_type: "Foo"
'
,
limit
:
[
0
,
1234567890
]},
use_remote_post
:
true
,
conflict_handling
:
3
,
...
...
@@ -153,6 +151,7 @@
equal
(
jio
.
__storage
.
_check_remote_attachment_deletion
,
true
);
equal
(
jio
.
__storage
.
_check_remote_attachment_modification
,
true
);
equal
(
jio
.
__storage
.
_custom_signature_sub_storage
,
false
);
ok
(
jio
.
__storage
.
_signature_sub_storage
instanceof
jio
.
constructor
);
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__type
,
"
query
"
);
...
...
@@ -173,7 +172,7 @@
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__storage
.
_sub_storage
.
__storage
.
_sub_storage
.
__type
,
"
signaturestorage2713
"
);
"
replicatestorage200
"
);
equal
(
jio
.
__storage
.
_signature_hash
,
"
_replicate_11881e431308c0ec8c0e6430be98db380e1b92f8
"
);
...
...
@@ -204,6 +203,36 @@
);
});
test
(
"
signature storage database
"
,
function
()
{
var
jio
=
jIO
.
createJIO
({
type
:
"
replicate
"
,
signature_sub_storage
:
{
type
:
"
memory
"
},
local_sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
memory
"
}
},
remote_sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
memory
"
}
}
});
equal
(
jio
.
__storage
.
_custom_signature_sub_storage
,
true
);
ok
(
jio
.
__storage
.
_signature_sub_storage
instanceof
jio
.
constructor
);
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__type
,
"
memory
"
);
ok
(
!
jio
.
__storage
.
hasOwnProperty
(
'
_signature_hash
'
),
jio
.
__storage
.
_signature_hash
);
});
/////////////////////////////////////////////////////////////////
// replicateStorage.get
/////////////////////////////////////////////////////////////////
...
...
@@ -701,4 +730,4 @@
});
});
}(
jIO
,
QUnit
,
Blob
));
\ No newline at end of file
}(
jIO
,
QUnit
,
Blob
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment