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
1527f4a9
Commit
1527f4a9
authored
Jan 10, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint pass storage.js
parent
ac79eed3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
189 deletions
+192
-189
src/jio/storages/storage.js
src/jio/storages/storage.js
+192
-189
No files found.
src/jio/storages/storage.js
View file @
1527f4a9
var
storage
=
function
(
spec
,
my
)
{
var
that
=
{};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true, jobManager: true, job: true */
var
storage
=
function
(
spec
,
my
)
{
var
that
=
{},
priv
=
{};
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
var
priv
=
{};
priv
.
type
=
spec
.
type
||
''
;
// Methods //
Object
.
defineProperty
(
that
,
"
getType
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
()
{
Object
.
defineProperty
(
that
,
"
getType
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
()
{
return
priv
.
type
;
}
});
...
...
@@ -19,7 +22,7 @@ var storage = function(spec, my) {
* @method execute
* @param {object} command The command
*/
that
.
execute
=
function
(
command
)
{
that
.
execute
=
function
(
command
)
{
that
.
success
=
command
.
success
;
that
.
error
=
command
.
error
;
that
.
retry
=
command
.
retry
;
...
...
@@ -34,7 +37,7 @@ var storage = function(spec, my) {
* @method isValid
* @return {boolean} true if ok, else false.
*/
that
.
isValid
=
function
()
{
that
.
isValid
=
function
()
{
return
true
;
};
...
...
@@ -42,9 +45,11 @@ var storage = function(spec, my) {
var
mess
=
that
.
validateState
();
if
(
mess
)
{
that
.
error
({
status
:
0
,
statusText
:
'
Invalid Storage
'
,
error
:
'
invalid_storage
'
,
message
:
mess
,
reason
:
mess
"
status
"
:
0
,
"
statusText
"
:
"
Invalid Storage
"
,
"
error
"
:
"
invalid_storage
"
,
"
message
"
:
mess
,
"
reason
"
:
mess
});
return
false
;
}
...
...
@@ -56,9 +61,9 @@ var storage = function(spec, my) {
* @method serialized
* @return {object} The serialized storage.
*/
that
.
serialized
=
function
()
{
that
.
serialized
=
function
()
{
var
o
=
that
.
specToStore
()
||
{};
o
[
"
type
"
]
=
that
.
getType
();
o
.
type
=
that
.
getType
();
return
o
;
};
...
...
@@ -78,7 +83,7 @@ var storage = function(spec, my) {
* @method validateState
* @return {string} empty: ok, else error message.
*/
that
.
validateState
=
function
()
{
that
.
validateState
=
function
()
{
return
''
;
};
...
...
@@ -154,24 +159,24 @@ var storage = function(spec, my) {
});
};
that
.
success
=
function
()
{};
that
.
retry
=
function
()
{};
that
.
error
=
function
()
{};
that
.
end
=
function
()
{};
// terminate the current job.
that
.
success
=
function
()
{};
that
.
retry
=
function
()
{};
that
.
error
=
function
()
{};
that
.
end
=
function
()
{};
// terminate the current job.
priv
.
newCommand
=
function
(
method
,
spec
)
{
var
o
=
spec
||
{};
o
.
label
=
method
;
return
command
(
o
,
my
);
return
command
(
o
,
my
);
};
priv
.
storage
=
my
.
storage
;
delete
my
.
storage
;
that
.
addJob
=
function
(
method
,
storage_spec
,
doc
,
option
,
success
,
error
)
{
that
.
addJob
=
function
(
method
,
storage_spec
,
doc
,
option
,
success
,
error
)
{
var
command_opt
=
{
options
:
option
,
callbacks
:{
success
:
success
,
error
:
error
}
callbacks
:
{
success
:
success
,
error
:
error
}
};
if
(
doc
)
{
if
(
method
===
'
get
'
)
{
...
...
@@ -180,12 +185,10 @@ var storage = function(spec, my) {
command_opt
.
doc
=
doc
;
}
}
jobManager
.
addJob
(
job
({
storage
:
priv
.
storage
(
storage_spec
||
{}),
command
:
priv
.
newCommand
(
method
,
command_opt
)
},
my
)
);
jobManager
.
addJob
(
job
({
storage
:
priv
.
storage
(
storage_spec
||
{}),
command
:
priv
.
newCommand
(
method
,
command_opt
)
},
my
));
};
return
that
;
...
...
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