~ubuntuone-control-tower/u1db/trunk

« back to all changes in this revision

Viewing changes to u1db/backends/inmemory.py

  • Committer: John Arbash Meinel
  • Date: 2012-05-18 08:43:21 UTC
  • mfrom: (290.2.4 transaction_ids_999574)
  • Revision ID: john@arbash-meinel.com-20120518084321-6j49o5wq3obh020r
Start storing transaction ids for put, and expose them for get_transaction_log.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
                index.remove_json(old_doc.doc_id, old_doc.content)
91
91
            if doc.content is not None:
92
92
                index.add_json(doc.doc_id, doc.content)
 
93
        trans_id = self._allocate_transaction_id()
93
94
        self._docs[doc.doc_id] = (doc.rev, doc.content)
94
 
        self._transaction_log.append(doc.doc_id)
 
95
        self._transaction_log.append((doc.doc_id, trans_id))
95
96
 
96
97
    def _get_doc(self, doc_id):
97
98
        try:
200
201
        cur_generation = old_generation + len(relevant_tail)
201
202
        seen = set()
202
203
        generation = cur_generation
203
 
        for doc_id in reversed(relevant_tail):
 
204
        for doc_id, trans_id in reversed(relevant_tail):
204
205
            if doc_id not in seen:
205
206
                changes.append((doc_id, generation))
206
207
                seen.add(doc_id)