Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
4b50d859
Commit
4b50d859
authored
Nov 29, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: newJio -> createJIO, minor fixes, lighter markup
parent
32a85df8
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
248 additions
and
250 deletions
+248
-250
docs/available_storages.rst
docs/available_storages.rst
+21
-21
docs/complex_queries.rst
docs/complex_queries.rst
+14
-14
docs/getting_started.rst
docs/getting_started.rst
+34
-36
docs/gid_storage.rst
docs/gid_storage.rst
+1
-1
docs/index.rst
docs/index.rst
+3
-3
docs/manage_documents.rst
docs/manage_documents.rst
+132
-132
docs/revision_storages.rst
docs/revision_storages.rst
+43
-43
No files found.
docs/available_storages.rst
View file @
4b50d859
...
@@ -28,9 +28,9 @@ LocalStorage
...
@@ -28,9 +28,9 @@ LocalStorage
Three methods are provided:
Three methods are provided:
* :js:`
createDescription(username, [application_name], [mode="localStorage"
])`
* :js:`
.createDescription(username, [application_name], [mode='localStorage'
])`
* :js:`createLocalDescription(username, [application_name])`
* :js:`
.
createLocalDescription(username, [application_name])`
* :js:`createMemoryDescription(username, [application_name])`
* :js:`
.
createMemoryDescription(username, [application_name])`
All parameters are strings.
All parameters are strings.
...
@@ -39,10 +39,10 @@ Examples:
...
@@ -39,10 +39,10 @@ Examples:
.. code-block:: javascript
.. code-block:: javascript
// to work on browser localStorage
// to work on browser localStorage
var jio = jIO.createJIO(local_storage.createDescription(
"me"
));
var jio = jIO.createJIO(local_storage.createDescription(
'me'
));
// to work on browser memory
// to work on browser memory
var jio = jIO.createJIO(local_storage.createMemoryDescription(
"me"
));
var jio = jIO.createJIO(local_storage.createMemoryDescription(
'me'
));
DavStorage
DavStorage
...
@@ -70,7 +70,7 @@ parameter required?
...
@@ -70,7 +70,7 @@ parameter required?
``password`` if auth-type != 'none'
``password`` if auth-type != 'none'
============= ========================
============= ========================
If ``auth_type`` is
"none"
, then ``realm``, ``username`` and ``password`` are never used.
If ``auth_type`` is
the string ``"none"``
, then ``realm``, ``username`` and ``password`` are never used.
**Be careful**: The generated description never contains a readable password, but
**Be careful**: The generated description never contains a readable password, but
for basic authentication, the password will just be base64 encoded.
for basic authentication, the password will just be base64 encoded.
...
@@ -92,7 +92,7 @@ IndexStorage
...
@@ -92,7 +92,7 @@ IndexStorage
^^^^^^^^^^^^
^^^^^^^^^^^^
This handler indexes documents metadata into a database (which is a simple
This handler indexes documents metadata into a database (which is a simple
document) to increase the speed of ``allDocs()`` requests. However, it is not able to
document) to increase the speed of ``
.
allDocs()`` requests. However, it is not able to
manage the ``include_docs`` option.
manage the ``include_docs`` option.
The sub storages have to manage ``query`` and ``include_docs`` options.
The sub storages have to manage ``query`` and ``include_docs`` options.
...
@@ -102,28 +102,28 @@ Here is the description:
...
@@ -102,28 +102,28 @@ Here is the description:
.. code-block:: javascript
.. code-block:: javascript
{
{
"type": "index"
,
type: 'index'
,
"indices"
: [{
indices
: [{
// doc id where to store indices
// doc id where to store indices
"id": "index_title_subject.json"
,
id: 'index_title_subject.json'
,
// metadata to index
// metadata to index
"index": ["title", "subject"
],
index: ['title', 'subject'
],
"attachment": "db.json", // default "body"
attachment: 'db.json', // default 'body'
// additional metadata to add to database, default undefined
// additional metadata to add to database, default undefined
"metadata"
: {
metadata
: {
"type": "Dataset"
,
type: 'Dataset'
,
"format": "application/json"
,
format: 'application/json'
,
"title": "My index database"
,
title: 'My index database'
,
"creator": "Me"
creator: 'Me'
},
},
// default equal to parent sub_storage field
// default equal to parent sub_storage field
"sub_storage"
: <sub storage where to store index>
sub_storage
: <sub storage where to store index>
}, {
}, {
"id": "index_year.json"
,
id: 'index_year.json'
,
"index": "year"
index: 'year'
...
...
}],
}],
"sub_storage"
: <sub storage description>
sub_storage
: <sub storage description>
}
}
...
...
docs/complex_queries.rst
View file @
4b50d859
...
@@ -42,20 +42,20 @@ Example:
...
@@ -42,20 +42,20 @@ Example:
var options = {};
var options = {};
// search text query
// search text query
options
['query']
= '(creator:"John Doe") AND (format:"pdf")';
options
.query
= '(creator:"John Doe") AND (format:"pdf")';
// OR query tree
// OR query tree
options
['query']
= {
options
.query
= {
type:'complex',
type:
'complex',
operator:'AND',
operator:
'AND',
query_list: [{
query_list: [{
"type": "simple"
,
type: 'simple'
,
"key": "creator"
,
key: 'creator'
,
"value": "John Doe"
value: 'John Doe'
}, {
}, {
"type": "simple"
,
type: 'simple'
,
"key": "format"
,
key: 'format'
,
"value": "pdf"
value: 'pdf'
}]
}]
};
};
...
@@ -168,8 +168,8 @@ want to use a wildcard, just set the wildcard character to an empty string.
...
@@ -168,8 +168,8 @@ want to use a wildcard, just set the wildcard character to an empty string.
.. code-block:: javascript
.. code-block:: javascript
var query = {
var query = {
"query"
: 'creator:"* Doe"',
query
: 'creator:"* Doe"',
"wildcard_character": "*"
wildcard_character: '*'
};
};
...
@@ -192,8 +192,8 @@ Example, convert Query object into a human readable string:
...
@@ -192,8 +192,8 @@ Example, convert Query object into a human readable string:
var query = complex_queries.QueryFactory.
var query = complex_queries.QueryFactory.
create('year: < 2000 OR title: "*a"'),
create('year: < 2000 OR title: "*a"'),
option = {
option = {
"wildcard_character": "*"
,
wildcard_character: '*'
,
"limit"
: [0, 10]
limit
: [0, 10]
},
},
human_read = {
human_read = {
"<": "is lower than ",
"<": "is lower than ",
...
...
docs/getting_started.rst
View file @
4b50d859
...
@@ -30,23 +30,21 @@ Getting started
...
@@ -30,23 +30,21 @@ Getting started
.. code-block:: javascript
.. code-block:: javascript
require.config({
require.config({
"paths"
: {
paths
: {
// jio core + dependency
// jio core + dependency
sha256: 'sha256.amd', // AMD-compatible version of sha256.js
// the AMD compatible version of sha256.js, see Download and Fork
rsvp: 'rsvp-custom',
"sha256": "sha256.amd",
jio: 'jio',
"rsvp": "rsvp-custom",
"jio": "jio",
// storages + dependencies
// storages + dependencies
"complex_queries": "complex_queries"
,
complex_queries: 'complex_queries'
,
"localstorage": "localstorage"
,
localstorage: 'localstorage'
,
"davstorage": "davstorage"
davstorage: 'davstorage'
}
}
});
});
#. jIO connects to a number of storages and allows adding handlers (or
#. jIO connects to a number of storages and allows adding handlers (or
functions) to specifc storages.
functions) to specif
i
c storages.
You can use both handlers and available storages to build a storage
You can use both handlers and available storages to build a storage
tree across which all documents will be maintained and managed by jIO.
tree across which all documents will be maintained and managed by jIO.
...
@@ -59,30 +57,30 @@ Getting started
...
@@ -59,30 +57,30 @@ Getting started
#. The jIO API provides ten main methods to manage documents across the storage(s) specified in your jIO storage tree.
#. The jIO API provides ten main methods to manage documents across the storage(s) specified in your jIO storage tree.
====================== ========================================================
======================
=
========================================================
Method Example
Method
Example
====================== ========================================================
======================
=
========================================================
``post()`` | :js:`my_jio.post(document, [options]);`
``
.
post()`` | :js:`my_jio.post(document, [options]);`
| Creates a new document
| Creates a new document
``put()`` | :js:`my_jio.put(document, [options]);`
``
.
put()`` | :js:`my_jio.put(document, [options]);`
| Creates/Updates a document
| Creates/Updates a document
``putAttachment()`` | :js:`my_jio.putAttachement(attachment, [options]);`
``
.
putAttachment()`` | :js:`my_jio.putAttachement(attachment, [options]);`
| Updates/Adds an attachment to a document
| Updates/Adds an attachment to a document
``get()`` | :js:`my_jio.get(document, [options]);`
``
.
get()`` | :js:`my_jio.get(document, [options]);`
| Reads a document
| Reads a document
``getAttachment()`` | :js:`my_jio.getAttachment(attachment, [options]);`
``
.
getAttachment()`` | :js:`my_jio.getAttachment(attachment, [options]);`
| Reads a document attachment
| Reads a document attachment
``remove()`` | :js:`my_jio.remove(document, [options]);`
``
.
remove()`` | :js:`my_jio.remove(document, [options]);`
| Deletes a document and its attachments
| Deletes a document and its attachments
``removeAttachment()`` | :js:`my_jio.removeAttachment(attachment, [options]);`
``
.
removeAttachment()`` | :js:`my_jio.removeAttachment(attachment, [options]);`
| Deletes a document's attachment
| Deletes a document's attachment
``allDocs()`` | :js:`my_jio.allDocs([options]);`
``
.
allDocs()`` | :js:`my_jio.allDocs([options]);`
| Retrieves a list of existing documents
| Retrieves a list of existing documents
``check()`` | :js:`my_jio.check(document, [options]);`
``
.
check()`` | :js:`my_jio.check(document, [options]);`
| Check
the document state
| Checks
the document state
``repair()`` | :js:`my_jio.repair(document, [options]);`
``
.
repair()`` | :js:`my_jio.repair(document, [options]);`
| Repair
the document
| Repairs
the document
====================== ========================================================
======================
=
========================================================
...
@@ -114,8 +112,8 @@ Storage dependencies
...
@@ -114,8 +112,8 @@ Storage dependencies
* `jquery.js <http://code.jquery.com/jquery.js>`_
* `jquery.js <http://code.jquery.com/jquery.js>`_
* `Stanford Javascript Crypto Library <http://bitwiseshiftleft.github.io/sjcl/>`_, [`sjcl.zip <https://crypto.stanford.edu/sjcl/sjcl.zip>`_]
* `Stanford Javascript Crypto Library <http://bitwiseshiftleft.github.io/sjcl/>`_, [`sjcl.zip <https://crypto.stanford.edu/sjcl/sjcl.zip>`_]
* `sha1 <http://pajhome.org.uk/crypt/md5/sha1.html>`_, [`sha1.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/lib/jsSha1/sha1.js>`_], AMD
compatible version: `sha1.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha1.amd.js>`_
* `sha1 <http://pajhome.org.uk/crypt/md5/sha1.html>`_, [`sha1.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/lib/jsSha1/sha1.js>`_], AMD
-
compatible version: `sha1.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha1.amd.js>`_
* `sha2, sha256 <http://anmar.eu.org/projects/jssha2/>`_, `jssha2.zip <http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip>`_, AMD
compatible versions: `sha2.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha2.amd.js>`_, `sha256.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha256.amd.js>`_
* `sha2, sha256 <http://anmar.eu.org/projects/jssha2/>`_, `jssha2.zip <http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip>`_, AMD
-
compatible versions: `sha2.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha2.amd.js>`_, `sha256.amd.js <http://git.erp5.org/gitweb/jio.git/blob_plain/refs/heads/master:/src/sha256.amd.js>`_
Storage connectors
Storage connectors
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
...
...
docs/gid_storage.rst
View file @
4b50d859
...
@@ -9,7 +9,7 @@ A storage to enable interoperability between all kind of storages.
...
@@ -9,7 +9,7 @@ A storage to enable interoperability between all kind of storages.
A global ID (GID) is a document id which represents a unique document. This ID
A global ID (GID) is a document id which represents a unique document. This ID
is then used to find this unique document on all types of backends.
is then used to find this unique document on all types of backends.
This storage uses sub storage
allDocs
and complex queries to find unique documents, and converts their ids to gids.
This storage uses sub storage
``.allDocs()``
and complex queries to find unique documents, and converts their ids to gids.
Where it can be used
Where it can be used
--------------------
--------------------
...
...
docs/index.rst
View file @
4b50d859
...
@@ -15,9 +15,9 @@ retrieve documents and specific information across storage trees.
...
@@ -15,9 +15,9 @@ retrieve documents and specific information across storage trees.
How does it work?
How does it work?
-----------------
-----------------
jIO is composed of two parts - jIO core and storage librar
y(ies)
. The core
jIO is composed of two parts - jIO core and storage librar
ies
. The core
is using
storage libraries (connectors) to interact with the associated remote
makes use of
storage libraries (connectors) to interact with the associated remote
storage servers. Some queries can be used on top of the
jIO ``
allDocs()`` method to
storage servers. Some queries can be used on top of the
``.
allDocs()`` method to
query documents based on defined criteria.
query documents based on defined criteria.
jIO uses a job management system, so each method call adds a job into a
jIO uses a job management system, so each method call adds a job into a
...
...
docs/manage_documents.rst
View file @
4b50d859
This diff is collapsed.
Click to expand it.
docs/revision_storages.rst
View file @
4b50d859
...
@@ -47,19 +47,19 @@ update is executed.
...
@@ -47,19 +47,19 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
var jio_instance = jIO.
newJio
({
var jio_instance = jIO.
createJIO
({
// replicate revision storage
// replicate revision storage
"type":"replicaterevision"
,
type: 'replicaterevision'
,
"storagelist"
:[{
storagelist
:[{
"type": "revision"
,
type: 'revision'
,
"sub_storage"
: {
sub_storage
: {
"type": "dav"
,
type: 'dav'
,
...
...
}
}
}, {
}, {
"type": "revision"
,
type: 'revision'
,
"sub_storage"
: {
sub_storage
: {
"type": "local"
,
type: 'local'
,
...
...
}
}
}]
}]
...
@@ -71,11 +71,11 @@ update is executed.
...
@@ -71,11 +71,11 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
jio_instance.post({
jio_instance.post({
"_id": "myNameCard"
,
_id: 'myNameCard'
,
"email": "me@web.com"
email: 'me@web.com'
}).then(function (response) {
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"1-5782E71F1E4BF698FA3793D9D5A96393"
// response.rev ->
'1-5782E71F1E4BF698FA3793D9D5A96393'
});
});
This will create the document on your WebDAV and local storage
This will create the document on your WebDAV and local storage
...
@@ -85,12 +85,12 @@ update is executed.
...
@@ -85,12 +85,12 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
jio_instance.put({
jio_instance.put({
"email": "my_new_me@web.com"
,
email: 'my_new_me@web.com'
,
"_id": "myNameCard"
_id: 'myNameCard'
"_rev": "1-5782E71F1E4BF698FA3793D9D5A96393"
_rev: '1-5782E71F1E4BF698FA3793D9D5A96393'
}).then(function (response) {
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"2-068E73F5B44FEC987B51354DFC772891"
// response.rev ->
'2-068E73F5B44FEC987B51354DFC772891'
});
});
Your smartphone is offline, so now you will have one version (1-578...) on
Your smartphone is offline, so now you will have one version (1-578...) on
...
@@ -100,19 +100,19 @@ update is executed.
...
@@ -100,19 +100,19 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
jio_instance.get({
"_id": "myNameCard"
}).then(function (response) {
jio_instance.get({
_id: 'myNameCard'
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"1-5782E71F1E4BF698FA3793D9D5A96393"
// response.rev ->
'1-5782E71F1E4BF698FA3793D9D5A96393'
// response.data.email ->
"me@web.com"
// response.data.email ->
'me@web.com'
return jio_instance.put({
return jio_instance.put({
"_id": "myNameCard"
,
_id: 'myNameCard'
,
"email": "me_again@web.com"
email: 'me_again@web.com'
});
});
}).then(function (response) {
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"2-3753476B70A49EA4D8C9039E7B04254C"
// response.rev ->
'2-3753476B70A49EA4D8C9039E7B04254C'
});
});
...
@@ -120,10 +120,10 @@ update is executed.
...
@@ -120,10 +120,10 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
jio_instance.get({
"_id": "myNameCard"
}).then(function (response) {
jio_instance.get({
_id: 'myNameCard'
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"2-3753476B70A49EA4D8C9039E7B04254C"
// response.rev ->
'2-3753476B70A49EA4D8C9039E7B04254C'
// response.data.email ->
"me_again@web.com"
// response.data.email ->
'me_again@web.com'
});
});
When multiple versions of a document are available, jIO returns the latest,
When multiple versions of a document are available, jIO returns the latest,
...
@@ -134,32 +134,32 @@ update is executed.
...
@@ -134,32 +134,32 @@ update is executed.
.. code-block:: javascript
.. code-block:: javascript
jio_instance.get({
"_id": "myNameCard"
}, {
jio_instance.get({
_id: 'myNameCard'
}, {
"conflicts"
: true
conflicts
: true
}).then(function (response) {
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"2-3753476B70A49EA4D8C9039E7B04254C"
,
// response.rev ->
'2-3753476B70A49EA4D8C9039E7B04254C'
,
// response.conflicts -> [
"2-068E73F5B44FEC987B51354DFC772891"
]
// response.conflicts -> [
'2-068E73F5B44FEC987B51354DFC772891'
]
});
});
The conflicting version (*2-068E...*) is displayed, because **{conflicts: true}** was
The conflicting version (*2-068E...*) is displayed, because **{conflicts: true}** was
specified in the GET call. Deleting either version will solve the conflict.
specified in the GET call. Deleting either version will solve the conflict.
#. Delete conflicting version:
#. Delete
the
conflicting version:
.. code-block:: javascript
.. code-block:: javascript
jio_instance.remove({
jio_instance.remove({
"_id": "myNameCard"
,
_id: 'myNameCard'
,
"_rev": "2-068E73F5B44FEC987B51354DFC772891"
_rev: '2-068E73F5B44FEC987B51354DFC772891'
}).then(function (response) {
}).then(function (response) {
// response.id ->
"myNameCard"
// response.id ->
'myNameCard'
// response.rev ->
"3-28910A4937537B5168E772896B70EC98"
// response.rev ->
'3-28910A4937537B5168E772896B70EC98'
});
});
When deleting the conflicting version of your namecard, jIO remove
s this
When deleting the conflicting version of your namecard, jIO remove
d it
version from all storages and sets the document tree leaf of this
version to
from all storages and set the document tree leaf of that
version to
deleted
. All storages now contain just a single version of the namecard
*deleted*
. All storages now contain just a single version of the namecard
(2-3753...). Note that, on the document tree, removing a revison will
(2-3753...). Note that, on the document tree, removing a revison will
create a new revision with status set to *deleted*.
create a new revision with status set to *deleted*.
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