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
lucas.parsy
jio
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
)
{
/*jslint indent: 2, maxlen: 80, sloppy: true */
var
that
=
{};
/*global command: true, jobManager: true, job: true */
var
storage
=
function
(
spec
,
my
)
{
var
that
=
{},
priv
=
{};
spec
=
spec
||
{};
spec
=
spec
||
{};
my
=
my
||
{};
my
=
my
||
{};
// Attributes //
// Attributes //
var
priv
=
{};
priv
.
type
=
spec
.
type
||
''
;
priv
.
type
=
spec
.
type
||
''
;
// Methods //
// Methods //
Object
.
defineProperty
(
that
,
"
getType
"
,{
Object
.
defineProperty
(
that
,
"
getType
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
configurable
:
false
,
function
()
{
enumerable
:
false
,
writable
:
false
,
value
:
function
()
{
return
priv
.
type
;
return
priv
.
type
;
}
}
});
});
...
@@ -19,7 +22,7 @@ var storage = function(spec, my) {
...
@@ -19,7 +22,7 @@ var storage = function(spec, my) {
* @method execute
* @method execute
* @param {object} command The command
* @param {object} command The command
*/
*/
that
.
execute
=
function
(
command
)
{
that
.
execute
=
function
(
command
)
{
that
.
success
=
command
.
success
;
that
.
success
=
command
.
success
;
that
.
error
=
command
.
error
;
that
.
error
=
command
.
error
;
that
.
retry
=
command
.
retry
;
that
.
retry
=
command
.
retry
;
...
@@ -34,7 +37,7 @@ var storage = function(spec, my) {
...
@@ -34,7 +37,7 @@ var storage = function(spec, my) {
* @method isValid
* @method isValid
* @return {boolean} true if ok, else false.
* @return {boolean} true if ok, else false.
*/
*/
that
.
isValid
=
function
()
{
that
.
isValid
=
function
()
{
return
true
;
return
true
;
};
};
...
@@ -42,9 +45,11 @@ var storage = function(spec, my) {
...
@@ -42,9 +45,11 @@ var storage = function(spec, my) {
var
mess
=
that
.
validateState
();
var
mess
=
that
.
validateState
();
if
(
mess
)
{
if
(
mess
)
{
that
.
error
({
that
.
error
({
status
:
0
,
statusText
:
'
Invalid Storage
'
,
"
status
"
:
0
,
error
:
'
invalid_storage
'
,
"
statusText
"
:
"
Invalid Storage
"
,
message
:
mess
,
reason
:
mess
"
error
"
:
"
invalid_storage
"
,
"
message
"
:
mess
,
"
reason
"
:
mess
});
});
return
false
;
return
false
;
}
}
...
@@ -56,9 +61,9 @@ var storage = function(spec, my) {
...
@@ -56,9 +61,9 @@ var storage = function(spec, my) {
* @method serialized
* @method serialized
* @return {object} The serialized storage.
* @return {object} The serialized storage.
*/
*/
that
.
serialized
=
function
()
{
that
.
serialized
=
function
()
{
var
o
=
that
.
specToStore
()
||
{};
var
o
=
that
.
specToStore
()
||
{};
o
[
"
type
"
]
=
that
.
getType
();
o
.
type
=
that
.
getType
();
return
o
;
return
o
;
};
};
...
@@ -78,7 +83,7 @@ var storage = function(spec, my) {
...
@@ -78,7 +83,7 @@ var storage = function(spec, my) {
* @method validateState
* @method validateState
* @return {string} empty: ok, else error message.
* @return {string} empty: ok, else error message.
*/
*/
that
.
validateState
=
function
()
{
that
.
validateState
=
function
()
{
return
''
;
return
''
;
};
};
...
@@ -154,24 +159,24 @@ var storage = function(spec, my) {
...
@@ -154,24 +159,24 @@ var storage = function(spec, my) {
});
});
};
};
that
.
success
=
function
()
{};
that
.
success
=
function
()
{};
that
.
retry
=
function
()
{};
that
.
retry
=
function
()
{};
that
.
error
=
function
()
{};
that
.
error
=
function
()
{};
that
.
end
=
function
()
{};
// terminate the current job.
that
.
end
=
function
()
{};
// terminate the current job.
priv
.
newCommand
=
function
(
method
,
spec
)
{
priv
.
newCommand
=
function
(
method
,
spec
)
{
var
o
=
spec
||
{};
var
o
=
spec
||
{};
o
.
label
=
method
;
o
.
label
=
method
;
return
command
(
o
,
my
);
return
command
(
o
,
my
);
};
};
priv
.
storage
=
my
.
storage
;
priv
.
storage
=
my
.
storage
;
delete
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
=
{
var
command_opt
=
{
options
:
option
,
options
:
option
,
callbacks
:{
success
:
success
,
error
:
error
}
callbacks
:
{
success
:
success
,
error
:
error
}
};
};
if
(
doc
)
{
if
(
doc
)
{
if
(
method
===
'
get
'
)
{
if
(
method
===
'
get
'
)
{
...
@@ -180,12 +185,10 @@ var storage = function(spec, my) {
...
@@ -180,12 +185,10 @@ var storage = function(spec, my) {
command_opt
.
doc
=
doc
;
command_opt
.
doc
=
doc
;
}
}
}
}
jobManager
.
addJob
(
jobManager
.
addJob
(
job
({
job
({
storage
:
priv
.
storage
(
storage_spec
||
{}),
storage
:
priv
.
storage
(
storage_spec
||
{}),
command
:
priv
.
newCommand
(
method
,
command_opt
)
command
:
priv
.
newCommand
(
method
,
command_opt
)
},
my
));
},
my
)
);
};
};
return
that
;
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