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
2f903beb
Commit
2f903beb
authored
Mar 21, 2017
by
Vincent Bechu
Committed by
Vincent Bechu
Mar 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replicatestorage: make attachment sync parallel for real
parent
b3950a82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
37 deletions
+45
-37
src/jio.storage/replicatestorage.js
src/jio.storage/replicatestorage.js
+37
-21
test/jio.storage/replicatestorage.tests.js
test/jio.storage/replicatestorage.tests.js
+8
-16
No files found.
src/jio.storage/replicatestorage.js
View file @
2f903beb
...
@@ -354,8 +354,8 @@
...
@@ -354,8 +354,8 @@
});
});
}
}
function
checkAttachmentSignatureDifference
(
skip_attachment_dict
,
function
checkAttachmentSignatureDifference
(
queue
,
skip_attachment_dict
,
queue
,
source
,
source
,
destination
,
id
,
name
,
destination
,
id
,
name
,
conflict_force
,
conflict_force
,
conflict_revert
,
conflict_revert
,
...
@@ -405,8 +405,8 @@
...
@@ -405,8 +405,8 @@
});
});
}
}
function
checkAttachmentLocalDeletion
(
skip_attachment_dict
,
function
checkAttachmentLocalDeletion
(
queue
,
skip_attachment_dict
,
queue
,
destination
,
id
,
name
,
source
,
destination
,
id
,
name
,
source
,
conflict_force
,
conflict_revert
,
conflict_force
,
conflict_revert
,
conflict_ignore
)
{
conflict_ignore
)
{
var
status_hash
;
var
status_hash
;
...
@@ -427,7 +427,9 @@
...
@@ -427,7 +427,9 @@
function
pushDocumentAttachment
(
skip_attachment_dict
,
id
,
source
,
function
pushDocumentAttachment
(
skip_attachment_dict
,
id
,
source
,
destination
,
options
)
{
destination
,
options
)
{
var
queue
=
new
RSVP
.
Queue
();
var
queue
=
new
RSVP
.
Queue
(),
local_dict
=
{},
signature_dict
=
{};
return
queue
return
queue
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -451,11 +453,10 @@
...
@@ -451,11 +453,10 @@
]);
]);
})
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
var
local_dict
=
{},
var
is_modification
,
signature_dict
=
{},
is_modification
,
is_creation
,
is_creation
,
key
;
key
,
argument_list
=
[];
for
(
key
in
result_list
[
0
])
{
for
(
key
in
result_list
[
0
])
{
if
(
result_list
[
0
].
hasOwnProperty
(
key
))
{
if
(
result_list
[
0
].
hasOwnProperty
(
key
))
{
if
(
!
skip_attachment_dict
.
hasOwnProperty
(
key
))
{
if
(
!
skip_attachment_dict
.
hasOwnProperty
(
key
))
{
...
@@ -478,30 +479,45 @@
...
@@ -478,30 +479,45 @@
is_creation
=
!
signature_dict
.
hasOwnProperty
(
key
)
is_creation
=
!
signature_dict
.
hasOwnProperty
(
key
)
&&
options
.
check_creation
;
&&
options
.
check_creation
;
if
(
is_modification
===
true
||
is_creation
===
true
)
{
if
(
is_modification
===
true
||
is_creation
===
true
)
{
checkAttachmentSignatureDifference
(
skip_attachment_dict
,
argument_list
.
push
([
undefined
,
queue
,
source
,
skip_attachment_dict
,
destination
,
id
,
key
,
source
,
options
.
conflict_force
,
destination
,
id
,
key
,
options
.
conflict_revert
,
options
.
conflict_force
,
options
.
conflict_ignore
,
options
.
conflict_revert
,
is_creation
,
options
.
conflict_ignore
,
is_modification
);
is_creation
,
is_modification
]);
}
}
}
}
}
}
return
dispatchQueue
(
checkAttachmentSignatureDifference
,
argument_list
,
context
.
_parallel_operation_attachment_amount
);
})
.
push
(
function
()
{
var
key
,
argument_list
=
[];
if
(
options
.
check_deletion
===
true
)
{
if
(
options
.
check_deletion
===
true
)
{
for
(
key
in
signature_dict
)
{
for
(
key
in
signature_dict
)
{
if
(
signature_dict
.
hasOwnProperty
(
key
))
{
if
(
signature_dict
.
hasOwnProperty
(
key
))
{
if
(
!
local_dict
.
hasOwnProperty
(
key
))
{
if
(
!
local_dict
.
hasOwnProperty
(
key
))
{
checkAttachmentLocalDeletion
(
skip_attachment_dict
,
argument_list
.
push
([
undefined
,
queue
,
destination
,
id
,
key
,
skip_attachment_dict
,
destination
,
id
,
key
,
source
,
source
,
options
.
conflict_force
,
options
.
conflict_force
,
options
.
conflict_revert
,
options
.
conflict_revert
,
options
.
conflict_ignore
);
options
.
conflict_ignore
]
);
}
}
}
}
}
}
return
dispatchQueue
(
checkAttachmentLocalDeletion
,
argument_list
,
context
.
_parallel_operation_attachment_amount
);
}
}
});
});
}
}
...
@@ -1074,7 +1090,7 @@
...
@@ -1074,7 +1090,7 @@
return
dispatchQueue
(
return
dispatchQueue
(
repairDocument
,
repairDocument
,
argument_list
,
argument_list
,
context
.
_parallel_operation_a
ttachment_a
mount
context
.
_parallel_operation_amount
);
);
});
});
}
}
...
...
test/jio.storage/replicatestorage.tests.js
View file @
2f903beb
...
@@ -7524,9 +7524,10 @@
...
@@ -7524,9 +7524,10 @@
console
.
log
(
"
get
"
,
id
);
console
.
log
(
"
get
"
,
id
);
return
this
.
_sub_storage
.
get
(
id
);
return
this
.
_sub_storage
.
get
(
id
);
};
};
Storage2713
.
prototype
.
getAttachment
=
function
(
id
)
{
Storage2713
.
prototype
.
getAttachment
=
function
()
{
var
storage
=
this
,
var
storage
=
this
,
argument_list
=
arguments
;
argument_list
=
arguments
,
id
=
argument_list
[
1
];
start_sync
[
id
]
=
true
;
start_sync
[
id
]
=
true
;
return
((
id
===
"
0
"
)
?
RSVP
.
delay
(
500
)
:
RSVP
.
delay
(
100
))
return
((
id
===
"
0
"
)
?
RSVP
.
delay
(
500
)
:
RSVP
.
delay
(
100
))
.
then
(
function
()
{
.
then
(
function
()
{
...
@@ -7586,27 +7587,18 @@
...
@@ -7586,27 +7587,18 @@
}
}
});
});
return
context
.
jio
.
put
(
"
0
"
,
{
"
title
"
:
"
foo
"
})
return
context
.
jio
.
put
(
"
foo
"
,
{})
.
push
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
0
"
,
"
foo
"
,
new
Blob
([
"
0
"
]));
})
.
push
(
function
()
{
return
context
.
jio
.
put
(
"
1
"
,
{
"
title
"
:
"
foo1
"
});
})
.
push
(
function
()
{
.
push
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
1
"
,
"
foo
"
,
new
Blob
([
"
1
"
]));
return
context
.
jio
.
putAttachment
(
"
foo
"
,
"
0
"
,
new
Blob
([
"
0
"
]));
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
context
.
jio
.
put
(
"
2
"
,
{
"
title
"
:
"
foo2
"
}
);
return
context
.
jio
.
put
Attachment
(
"
foo
"
,
"
1
"
,
new
Blob
([
"
1
"
])
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
2
"
,
"
foo
"
,
new
Blob
([
"
2
"
]));
return
context
.
jio
.
putAttachment
(
"
foo
"
,
"
2
"
,
new
Blob
([
"
2
"
]));
})
.
push
(
function
()
{
return
context
.
jio
.
put
(
"
3
"
,
{
"
title
"
:
"
foo3
"
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
3
"
,
"
foo
"
,
new
Blob
([
"
3
"
]));
return
context
.
jio
.
putAttachment
(
"
foo
"
,
"
3
"
,
new
Blob
([
"
3
"
]));
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
context
.
jio
.
repair
();
return
context
.
jio
.
repair
();
...
...
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