def _assert_ready(self): self._assert_open() if not self.ready: # TODO: add transaction identifier raise BoltTransactionError( "A transaction is already in progress on " "this connection", self.remote_address)
async def rollback(self): self._assert_open() if self._autocommit: raise BoltTransactionError( "Cannot explicitly rollback an auto-commit " "transaction", self._courier.remote_address) try: self._courier.write_rollback() await self._courier.send() await self._courier.fetch() finally: self._closed = True
async def commit(self): self._assert_open() if self._autocommit: raise BoltTransactionError( "Cannot explicitly commit an auto-commit " "transaction", self._courier.remote_address) try: commit = self._courier.write_commit() await self._courier.send() await self._courier.fetch() summary = await commit.get_summary() return Bookmark(summary.metadata.get("bookmark")) finally: self._closed = True
def _assert_open(self): if self.closed: raise BoltTransactionError("Transaction is already " "closed", self._courier.remote_address)