def merge_context(self, src=None): if src is None: # This condition will be true only if the server doesn't return a # txn context after a query or mutation. return util.merge_lin_reads(self._ctx.lin_read, src.lin_read) self._dc.merge_lin_reads(src.lin_read) if self._ctx.start_ts == 0: self._ctx.start_ts = src.start_ts elif self._ctx.start_ts != src.start_ts: # This condition should never be true. raise Exception('StartTs mismatch') self._ctx.keys.extend(src.keys[:])
def merge_context(self, txn_context): """Merges context from a txn context into the current txn state.""" ## This will be true if the server does not return a txn context after ## a query or a mutation if not txn_context: return if self.start_ts == 0: self.start_ts = txn_context.start_ts elif self.start_ts != txn_context.start_ts: raise Exception( 'StartTs mismatch in txn(%s) vs updated context(%s)' % (self.start_ts, txn_context.start_ts)) self.client.merge_context(txn_context) util.merge_lin_reads(self.lin_read, txn_context.lin_read) self.keys = txn_context.keys[:]
def merge_context(self, context): """Merges txn_context into client's state.""" util.merge_lin_reads(self.lin_read, context.lin_read)
def common_test(self, lr1, lr2, expected): self.assertTrue( helper.are_lin_reads_equal(util.merge_lin_reads(lr1, lr2), expected)) self.assertTrue(helper.are_lin_reads_equal(lr1, expected))
def merge_lin_reads(self, src): util.merge_lin_reads(self._lin_read, src)