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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaohe Cao
jio
Commits
dafc0c70
Commit
dafc0c70
authored
Apr 24, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SHA storage (create only new document)
parent
bd52f34e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
452 additions
and
0 deletions
+452
-0
Gruntfile.js
Gruntfile.js
+1
-0
src/jio.storage/shastorage.js
src/jio.storage/shastorage.js
+61
-0
test/jio.storage/shastorage.tests.js
test/jio.storage/shastorage.tests.js
+389
-0
test/tests.html
test/tests.html
+1
-0
No files found.
Gruntfile.js
View file @
dafc0c70
...
...
@@ -174,6 +174,7 @@ module.exports = function (grunt) {
'
node_modules/rusha/rusha.js
'
,
'
src/jio.storage/replicatestorage.js
'
,
'
src/jio.storage/shastorage.js
'
,
'
src/jio.storage/uuidstorage.js
'
,
'
src/jio.storage/memorystorage.js
'
,
'
src/jio.storage/localstorage.js
'
,
...
...
src/jio.storage/shastorage.js
0 → 100644
View file @
dafc0c70
/*
* Copyright 2015, Nexedi SA
* Released under the LGPL license.
* http://www.gnu.org/licenses/lgpl.html
*/
/*jslint nomen: true*/
/*global Rusha*/
/**
* JIO Sha Storage. Type = 'sha'.
*/
(
function
(
Rusha
)
{
"
use strict
"
;
var
rusha
=
new
Rusha
();
function
ShaStorage
(
spec
)
{
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
}
ShaStorage
.
prototype
.
post
=
function
(
param
)
{
return
this
.
_sub_storage
.
put
(
rusha
.
digestFromString
(
JSON
.
stringify
(
param
)),
param
);
};
ShaStorage
.
prototype
.
get
=
function
()
{
return
this
.
_sub_storage
.
get
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
remove
=
function
()
{
return
this
.
_sub_storage
.
remove
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
hasCapacity
=
function
()
{
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
buildQuery
=
function
()
{
return
this
.
_sub_storage
.
buildQuery
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
getAttachment
=
function
()
{
return
this
.
_sub_storage
.
getAttachment
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
putAttachment
=
function
()
{
return
this
.
_sub_storage
.
putAttachment
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
removeAttachment
=
function
()
{
return
this
.
_sub_storage
.
removeAttachment
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
allAttachments
=
function
()
{
return
this
.
_sub_storage
.
allAttachments
.
apply
(
this
.
_sub_storage
,
arguments
);
};
ShaStorage
.
prototype
.
repair
=
function
()
{
return
this
.
_sub_storage
.
repair
.
apply
(
this
.
_sub_storage
,
arguments
);
};
jIO
.
addStorage
(
'
sha
'
,
ShaStorage
);
}(
Rusha
));
test/jio.storage/shastorage.tests.js
0 → 100644
View file @
dafc0c70
This diff is collapsed.
Click to expand it.
test/tests.html
View file @
dafc0c70
...
...
@@ -39,6 +39,7 @@
<script
src=
"jio.storage/indexeddbstorage.tests.js"
></script>
<script
src=
"jio.storage/uuidstorage.tests.js"
></script>
<script
src=
"jio.storage/replicatestorage.tests.js"
></script>
<script
src=
"jio.storage/shastorage.tests.js"
></script>
<!--script src="jio.storage/indexstorage.tests.js"></script-->
<!--script src="jio.storage/dropboxstorage.tests.js"></script-->
...
...
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