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
c0c9301e
Commit
c0c9301e
authored
Apr 09, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allDocs optimization
parent
d4e4af04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
src/jio.storage/replicatestorage.js
src/jio.storage/replicatestorage.js
+20
-20
No files found.
src/jio.storage/replicatestorage.js
View file @
c0c9301e
...
...
@@ -521,42 +521,42 @@
};
ReplicateStorage
.
prototype
.
allDocs
=
function
(
command
,
param
,
option
)
{
/*jslint unparam: true */
var
promise_list
=
[],
index
,
length
=
this
.
_storage_list
.
length
;
for
(
index
=
0
;
index
<
length
;
index
+=
1
)
{
promise_list
[
index
]
=
success
(
command
.
storage
(
this
.
_storage_list
[
index
]).
allDocs
(
option
));
}
sequence
([
function
()
{
return
all
(
promise_list
);
},
function
(
answers
)
{
all
(
promise_list
).
then
(
function
(
answers
)
{
// merge responses
var
i
,
j
,
k
,
found
,
rows
;
// browsing answers
for
(
i
=
0
;
i
<
answers
.
length
;
i
+=
1
)
{
if
(
answers
[
i
].
result
===
"
success
"
)
{
if
(
!
rows
)
{
rows
=
answers
[
i
].
data
.
rows
;
}
else
{
// browsing answer rows
for
(
j
=
0
;
j
<
answers
[
i
].
data
.
rows
.
length
;
j
+=
1
)
{
found
=
false
;
// browsing result rows
for
(
k
=
0
;
k
<
rows
.
length
;
k
+=
1
)
{
if
(
rows
[
k
].
id
===
answers
[
i
].
data
.
rows
[
j
].
id
)
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
rows
.
push
(
answers
[
i
].
data
.
rows
[
j
]);
rows
=
answers
[
i
].
data
.
rows
;
break
;
}
}
for
(
i
+=
1
;
i
<
answers
.
length
;
i
+=
1
)
{
if
(
answers
[
i
].
result
===
"
success
"
)
{
// browsing answer rows
for
(
j
=
0
;
j
<
answers
[
i
].
data
.
rows
.
length
;
j
+=
1
)
{
found
=
false
;
// browsing result rows
for
(
k
=
0
;
k
<
rows
.
length
;
k
+=
1
)
{
if
(
rows
[
k
].
id
===
answers
[
i
].
data
.
rows
[
j
].
id
)
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
rows
.
push
(
answers
[
i
].
data
.
rows
[
j
]);
}
}
}
}
return
{
"
data
"
:
{
"
total_rows
"
:
(
rows
||
[]).
length
,
"
rows
"
:
rows
||
[]}};
},
[
command
.
success
,
command
.
error
]]);
}).
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
/*jslint unparam: true */
};
ReplicateStorage
.
prototype
.
check
=
function
(
command
,
param
,
option
)
{
...
...
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