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
47d314ae
Commit
47d314ae
authored
Mar 20, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check & repair added to gidstorage
parent
179cacb0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
src/jio.storage/gidstorage.js
src/jio.storage/gidstorage.js
+35
-0
No files found.
src/jio.storage/gidstorage.js
View file @
47d314ae
...
...
@@ -585,6 +585,41 @@
err
.
message
=
"
Cannot get all documents
"
;
return
command
.
error
(
err
);
});
};
that
.
check
=
function
(
command
,
param
,
options
)
{
return
that
.
repair
(
command
,
param
,
options
,
"
check
"
);
};
that
.
repair
=
function
(
command
,
param
,
options
,
action
)
{
var
gid_object
,
jio_query
,
sub_storage
;
if
(
typeof
param
.
_id
!==
"
string
"
||
!
param
.
_id
)
{
return
command
.
error
(
"
bad_request
"
,
"
document id must be provided
"
);
}
if
(
action
===
undefined
)
{
action
=
"
repair
"
;
}
gid_object
=
gidParse
(
param
.
_id
,
priv
.
constraints
);
if
(
gid_object
===
undefined
)
{
return
command
.
error
(
"
bad_request
"
,
"
metadata should respect constraints
"
,
"
Cannot
"
+
action
+
"
document
"
);
}
jio_query
=
gidToJIOQuery
(
gid_object
);
sub_storage
=
command
.
storage
(
priv
.
sub_storage
);
sub_storage
.
allDocs
({
"
query
"
:
jio_query
}).
then
(
function
(
response
)
{
response
=
response
.
data
;
if
(
response
.
total_rows
===
0
)
{
// document not found, nothing to repair or check
return
command
.
success
();
}
return
sub_storage
[
action
]({
"
_id
"
:
response
.
rows
[
0
].
id
},
options
);
}).
then
(
command
.
success
,
command
.
error
);
};
}
...
...
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