예제 #1
0
 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)
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 def _assert_open(self):
     if self.closed:
         raise BoltTransactionError("Transaction is already "
                                    "closed", self._courier.remote_address)