Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
3914e4e4
Commit
3914e4e4
authored
May 29, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplicateStorage: allow to reduce number of checks during synchronization
parent
6823e03e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
465 additions
and
12 deletions
+465
-12
src/jio.storage/replicatestorage.js
src/jio.storage/replicatestorage.js
+58
-11
test/jio.storage/replicatestorage.tests.js
test/jio.storage/replicatestorage.tests.js
+407
-1
No files found.
src/jio.storage/replicatestorage.js
View file @
3914e4e4
...
...
@@ -53,6 +53,30 @@
});
this
.
_use_remote_post
=
spec
.
use_remote_post
||
false
;
this
.
_check_local_modification
=
spec
.
check_local_modification
;
if
(
this
.
_check_local_modification
===
undefined
)
{
this
.
_check_local_modification
=
true
;
}
this
.
_check_local_creation
=
spec
.
check_local_creation
;
if
(
this
.
_check_local_creation
===
undefined
)
{
this
.
_check_local_creation
=
true
;
}
this
.
_check_local_deletion
=
spec
.
check_local_deletion
;
if
(
this
.
_check_local_deletion
===
undefined
)
{
this
.
_check_local_deletion
=
true
;
}
this
.
_check_remote_modification
=
spec
.
check_remote_modification
;
if
(
this
.
_check_remote_modification
===
undefined
)
{
this
.
_check_remote_modification
=
true
;
}
this
.
_check_remote_creation
=
spec
.
check_remote_creation
;
if
(
this
.
_check_remote_creation
===
undefined
)
{
this
.
_check_remote_creation
=
true
;
}
this
.
_check_remote_deletion
=
spec
.
check_remote_deletion
;
if
(
this
.
_check_remote_deletion
===
undefined
)
{
this
.
_check_remote_deletion
=
true
;
}
}
ReplicateStorage
.
prototype
.
remove
=
function
(
id
)
{
...
...
@@ -304,19 +328,25 @@
signature_dict
[
result_list
[
1
].
data
.
rows
[
i
].
id
]
=
i
;
}
}
for
(
key
in
local_dict
)
{
if
(
local_dict
.
hasOwnProperty
(
key
))
{
if
(
!
signature_dict
.
hasOwnProperty
(
key
))
{
checkLocalCreation
(
queue
,
source
,
destination
,
key
,
options
);
if
(
options
.
check_creation
===
true
)
{
for
(
key
in
local_dict
)
{
if
(
local_dict
.
hasOwnProperty
(
key
))
{
if
(
!
signature_dict
.
hasOwnProperty
(
key
))
{
checkLocalCreation
(
queue
,
source
,
destination
,
key
,
options
);
}
}
}
}
for
(
key
in
signature_dict
)
{
if
(
signature_dict
.
hasOwnProperty
(
key
))
{
if
(
local_dict
.
hasOwnProperty
(
key
))
{
checkSignatureDifference
(
queue
,
source
,
destination
,
key
);
if
(
options
.
check_modification
===
true
)
{
checkSignatureDifference
(
queue
,
source
,
destination
,
key
);
}
}
else
{
checkLocalDeletion
(
queue
,
destination
,
key
,
source
);
if
(
options
.
check_deletion
===
true
)
{
checkLocalDeletion
(
queue
,
destination
,
key
,
source
);
}
}
}
}
...
...
@@ -360,13 +390,30 @@
})
.
push
(
function
()
{
return
pushStorage
(
context
.
_local_sub_storage
,
context
.
_remote_sub_storage
,
{
use_post
:
context
.
_use_remote_post
});
if
(
context
.
_check_local_modification
||
context
.
_check_local_creation
||
context
.
_check_local_deletion
)
{
return
pushStorage
(
context
.
_local_sub_storage
,
context
.
_remote_sub_storage
,
{
use_post
:
context
.
_use_remote_post
,
check_modification
:
context
.
_check_local_modification
,
check_creation
:
context
.
_check_local_creation
,
check_deletion
:
context
.
_check_local_deletion
});
}
})
.
push
(
function
()
{
return
pushStorage
(
context
.
_remote_sub_storage
,
context
.
_local_sub_storage
,
{});
if
(
context
.
_check_remote_modification
||
context
.
_check_remote_creation
||
context
.
_check_remote_deletion
)
{
return
pushStorage
(
context
.
_remote_sub_storage
,
context
.
_local_sub_storage
,
{
check_modification
:
context
.
_check_remote_modification
,
check_creation
:
context
.
_check_remote_creation
,
check_deletion
:
context
.
_check_remote_deletion
});
}
});
};
...
...
test/jio.storage/replicatestorage.tests.js
View file @
3914e4e4
This diff is collapsed.
Click to expand it.
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