diff options
author | Kali Kaneko <kali@leap.se> | 2014-02-07 05:50:55 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-02-17 11:39:44 -0400 |
commit | b92e63c316c1cf9f8b6481dbfa70737acfb3eee9 (patch) | |
tree | e60e9b6e5367ad185c9f387f2ff6af9fd6c726f9 /src/leap/mail/imap/soledadstore.py | |
parent | 813db4a356141592337f39f9c801203367c63193 (diff) |
separate better dirty/new flags; add cdocs
Diffstat (limited to 'src/leap/mail/imap/soledadstore.py')
-rw-r--r-- | src/leap/mail/imap/soledadstore.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/leap/mail/imap/soledadstore.py b/src/leap/mail/imap/soledadstore.py index a74b49c..6cd3749 100644 --- a/src/leap/mail/imap/soledadstore.py +++ b/src/leap/mail/imap/soledadstore.py @@ -212,10 +212,8 @@ class SoledadStore(ContentDedup): to be inserted. :type queue: Queue """ - # TODO should delete the original message from incoming only after - # the writes are done. # TODO should handle the delete case - # TODO should handle errors + # TODO should handle errors better # TODO could generalize this method into a generic consumer # and only implement `process` here @@ -235,7 +233,7 @@ class SoledadStore(ContentDedup): Errorback for write operations. """ log.msg("ERROR: Error while processing item.") - log.msg(failure.getTraceBack()) + log.msg(failure.getTraceback()) while not queue.empty(): doc_wrapper = queue.get() @@ -354,6 +352,7 @@ class SoledadStore(ContentDedup): doc = self._GET_DOC_FUN(doc_id) doc.content = dict(item.content) item = doc + try: call(item) except u1db_errors.RevisionConflict as exc: @@ -451,6 +450,7 @@ class SoledadStore(ContentDedup): :type mbox: str or unicode :param uid: the UID for the message :type uid: int + :rtype: SoledadDocument or None """ result = None try: @@ -465,6 +465,20 @@ class SoledadStore(ContentDedup): finally: return result + def get_headers_doc(self, chash): + """ + Return the document that keeps the headers for a message + indexed by its content-hash. + + :param chash: the content-hash to retrieve the document from. + :type chash: str or unicode + :rtype: SoledadDocument or None + """ + head_docs = self._soledad.get_from_index( + fields.TYPE_C_HASH_IDX, + fields.TYPE_HEADERS_VAL, str(chash)) + return first(head_docs) + def write_last_uid(self, mbox, value): """ Write the `last_uid` integer to the proper mailbox document |