diff options
author | drebs <drebs@leap.se> | 2012-12-03 16:08:49 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2012-12-03 16:08:49 -0200 |
commit | 26f2abf21f295700c0f8fdf3bd62667562f01ea3 (patch) | |
tree | 8d85c9297ff885cd47b31c38e7e629f3cb839c8e /src/leap/soledad | |
parent | 22d517e97d81c5630b85dbf55c40f2716d608e96 (diff) |
Add put_object for u1db OpenStack backend.
Diffstat (limited to 'src/leap/soledad')
-rw-r--r-- | src/leap/soledad/openstack.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/leap/soledad/openstack.py b/src/leap/soledad/openstack.py index 9bb4fddd..25f1a404 100644 --- a/src/leap/soledad/openstack.py +++ b/src/leap/soledad/openstack.py @@ -43,7 +43,16 @@ class OpenStackDatabase(CommonBackend): raise NotImplementedError(self.get_all_docs) def put_doc(self, doc): - raise NotImplementedError(self.put_doc) + if doc.doc_id is None: + raise errors.InvalidDocId() + self._check_doc_id(doc.doc_id) + self._check_doc_size(doc) + # TODO: check for conflicts? + new_rev = self._allocate_doc_rev(doc.rev) + headers = { 'X-Object-Meta-Rev' : new_rev } + self._connection.put_object(self._container, doc_id, doc.get_json(), + headers=headers) + return new_rev def delete_doc(self, doc): raise NotImplementedError(self.delete_doc) |