summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2012-12-24 13:02:47 -0200
committerdrebs <drebs@leap.se>2012-12-24 13:02:47 -0200
commitbc83c4e3ce0bed00604fa876eff4c77da7531aa8 (patch)
tree9adc85219f0e594e9166affe15d2dfb007327ef9
parent948f12a655435968f2754209f8031516433255f4 (diff)
Add basic doc methods mapping for local encrypted storage.
-rw-r--r--src/leap/soledad/__init__.py48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py
index f0d1cbb9..3ed82ca7 100644
--- a/src/leap/soledad/__init__.py
+++ b/src/leap/soledad/__init__.py
@@ -146,20 +146,54 @@ class Soledad(object):
# Document storage/retrieval and sync
#-------------------------------------------------------------------------
- def put(self, doc_id, data):
+ def put_doc(self, doc):
"""
- Store a document in the local encrypted database.
+ Update a document in the local encrypted database.
"""
- pass
+ return self._db.put_doc(doc)
- def get(self, doc_id):
+ def delete_doc(self, doc):
+ """
+ Delete a document from the local encrypted database.
+ """
+ return self._db.delete_doc(doc)
+
+ def get_doc(self, doc_id, include_deleted=False):
"""
Retrieve a document from the local encrypted database.
"""
- pass
+ return self._db.get_doc(doc_id, include_deleted=include_deleted)
+
+ def get_docs(self, doc_ids, check_for_conflicts=True,
+ include_deleted=False):
+ """
+ Get the content for many documents.
+ """
+ return self._db.get_docs(doc_ids,
+ check_for_conflicts=check_for_conflicts,
+ include_deleted=include_deleted)
+
+ def create_doc(self, content, doc_id=None):
+ """
+ Create a new document in the local encrypted database.
+ """
+ return self._db.create_doc(content, doc_id=doc_id)
+
+ def get_doc_conflicts(self, doc_id):
+ """
+ Get the list of conflicts for the given document.
+ """
+ return self._db.get_doc_conflicts(doc_id)
- def sync(self):
+ def resolve_doc(self, doc, conflicted_doc_revs):
+ """
+ Mark a document as no longer conflicted.
+ """
+ return self._db.resolve_doc(doc, conflicted_doc_revs)
+
+ def sync(self, url):
"""
Synchronize the local encrypted database with LEAP server.
"""
- pass
+ # TODO: create authentication scheme for sync with server.
+ return self._db.sync(url, creds=None, autocreate=True)