Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
jio
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 @@
...
@@ -50,19 +50,25 @@
this
.
_local_sub_storage
=
jIO
.
createJIO
(
spec
.
local_sub_storage
);
this
.
_local_sub_storage
=
jIO
.
createJIO
(
spec
.
local_sub_storage
);
this
.
_remote_sub_storage
=
jIO
.
createJIO
(
spec
.
remote_sub_storage
);
this
.
_remote_sub_storage
=
jIO
.
createJIO
(
spec
.
remote_sub_storage
);
this
.
_signature_hash
=
"
_replicate_
"
+
generateHash
(
if
(
spec
.
hasOwnProperty
(
'
signature_sub_storage
'
))
{
stringify
(
spec
.
local_sub_storage
)
+
this
.
_signature_sub_storage
=
jIO
.
createJIO
(
spec
.
signature_sub_storage
);
stringify
(
spec
.
remote_sub_storage
)
+
this
.
_custom_signature_sub_storage
=
true
;
stringify
(
this
.
_query_options
)
}
else
{
);
this
.
_signature_hash
=
"
_replicate_
"
+
generateHash
(
this
.
_signature_sub_storage
=
jIO
.
createJIO
({
stringify
(
spec
.
local_sub_storage
)
+
type
:
"
query
"
,
stringify
(
spec
.
remote_sub_storage
)
+
sub_storage
:
{
stringify
(
this
.
_query_options
)
type
:
"
document
"
,
);
document_id
:
this
.
_signature_hash
,
this
.
_signature_sub_storage
=
jIO
.
createJIO
({
sub_storage
:
spec
.
signature_storage
||
spec
.
local_sub_storage
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
;
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
...
@@ -937,16 +943,18 @@
...
@@ -937,16 +943,18 @@
argument_list
=
arguments
,
argument_list
=
arguments
,
skip_document_dict
=
{};
skip_document_dict
=
{};
// Do not sync the signature document
skip_document_dict
[
context
.
_signature_hash
]
=
null
;
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
if
(
context
.
_custom_signature_sub_storage
===
false
)
{
.
__storage
.
_sub_storage
.
get
(
// Do not sync the signature document
context
.
_signature_hash
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
)
{
.
push
(
undefined
,
function
(
error
)
{
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
...
...
test/jio.storage/replicatestorage.tests.js
View file @
40ef31b0
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
equal
(
jio
.
__storage
.
_check_remote_attachment_deletion
,
false
);
equal
(
jio
.
__storage
.
_check_remote_attachment_deletion
,
false
);
equal
(
jio
.
__storage
.
_check_remote_attachment_modification
,
false
);
equal
(
jio
.
__storage
.
_check_remote_attachment_modification
,
false
);
equal
(
jio
.
__storage
.
_custom_signature_sub_storage
,
false
);
equal
(
jio
.
__storage
.
_signature_hash
,
equal
(
jio
.
__storage
.
_signature_hash
,
"
_replicate_7209dfbcaff00f6637f939fdd71fa896793ed385
"
);
"
_replicate_7209dfbcaff00f6637f939fdd71fa896793ed385
"
);
...
@@ -110,9 +111,6 @@
...
@@ -110,9 +111,6 @@
remote_sub_storage
:
{
remote_sub_storage
:
{
type
:
"
replicatestorage500
"
type
:
"
replicatestorage500
"
},
},
signature_storage
:
{
type
:
"
signaturestorage2713
"
},
query
:
{
query
:
'
portal_type: "Foo"
'
,
limit
:
[
0
,
1234567890
]},
query
:
{
query
:
'
portal_type: "Foo"
'
,
limit
:
[
0
,
1234567890
]},
use_remote_post
:
true
,
use_remote_post
:
true
,
conflict_handling
:
3
,
conflict_handling
:
3
,
...
@@ -153,6 +151,7 @@
...
@@ -153,6 +151,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
.
_custom_signature_sub_storage
,
false
);
ok
(
jio
.
__storage
.
_signature_sub_storage
instanceof
jio
.
constructor
);
ok
(
jio
.
__storage
.
_signature_sub_storage
instanceof
jio
.
constructor
);
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__type
,
"
query
"
);
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__type
,
"
query
"
);
...
@@ -173,7 +172,7 @@
...
@@ -173,7 +172,7 @@
equal
(
jio
.
__storage
.
_signature_sub_storage
equal
(
jio
.
__storage
.
_signature_sub_storage
.
__storage
.
_sub_storage
.
__storage
.
_sub_storage
.
__storage
.
_sub_storage
.
__type
,
.
__storage
.
_sub_storage
.
__type
,
"
signaturestorage2713
"
);
"
replicatestorage200
"
);
equal
(
jio
.
__storage
.
_signature_hash
,
equal
(
jio
.
__storage
.
_signature_hash
,
"
_replicate_11881e431308c0ec8c0e6430be98db380e1b92f8
"
);
"
_replicate_11881e431308c0ec8c0e6430be98db380e1b92f8
"
);
...
@@ -204,6 +203,36 @@
...
@@ -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
// replicateStorage.get
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -701,4 +730,4 @@
...
@@ -701,4 +730,4 @@
});
});
});
});
}(
jIO
,
QUnit
,
Blob
));
}(
jIO
,
QUnit
,
Blob
));
\ No newline at end of file
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