예제 #1
0
 def rollback(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: RUN 'ROLLBACK' {}", self.local_port)
     log.debug("[#%04X] C: DISCARD_ALL", self.local_port)
     try:
         self._sync(self._write_request(0x10, "ROLLBACK", {}),
                    self._write_request(0x2F))
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(
             BrokenTransactionError("Transaction broken by disconnection "
                                    "during rollback"), error)
     else:
         try:
             self._audit(self._transaction)
         except Failure as failure:
             tx.mark_broken()
             raise_from(
                 BrokenTransactionError("Failed to rollback transaction"),
                 failure)
         else:
             return Bookmark()
     finally:
         if callable(self._on_unbind):
             self._on_unbind(self._transaction)
예제 #2
0
 def rollback(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: ROLLBACK", self.local_port)
     response = self._write_request(0x13)
     try:
         self._sync(response)
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(
             BrokenTransactionError("Transaction broken by disconnection "
                                    "during rollback"), error)
     else:
         try:
             self._audit(self._transaction)
         except Failure as failure:
             tx.mark_broken()
             raise_from(
                 BrokenTransactionError("Failed to rollback transaction"),
                 failure)
         else:
             return Bookmark(response.metadata.get("bookmark"))
     finally:
         if callable(self._on_unbind):
             self._on_unbind(self._transaction)
예제 #3
0
 def rollback(self, tx):
     self._assert_transaction_open(tx)
     self.__transactions.remove(tx)
     try:
         r = self._delete(tx.uri())
     except ConnectionError as error:
         tx.mark_broken()
         raise_from(
             BrokenTransactionError("Transaction broken by disconnection "
                                    "during rollback"), error)
     except HTTPError as error:
         tx.mark_broken()
         raise_from(
             BrokenTransactionError("Transaction broken by HTTP error "
                                    "during rollback"), error)
     else:
         if r.status != 200:
             tx.mark_broken()
             raise BrokenTransactionError(
                 "Transaction broken by HTTP %d status "
                 "during rollback" % r.status)
         rs = HTTPResponse.from_json(r.status, r.data.decode("utf-8"))
         self.release()
         rs.audit(tx)
         return Bookmark()
예제 #4
0
파일: bolt.py 프로젝트: moomoohk/py2neo
 def commit(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: COMMIT", self.local_port)
     response = self._write_request(0x12)
     try:
         self._sync(response)
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(
             ConnectionBroken("Transaction broken by disconnection "
                              "during commit"), error)
     else:
         try:
             self._audit(self._transaction)
         except Neo4jError as error:
             tx.mark_broken()
             raise_from(ConnectionBroken("Failed to commit transaction"),
                        error)
         else:
             return Bookmark(response.metadata.get("bookmark"))
     finally:
         if callable(self._on_unbind):
             self._on_unbind(self._transaction)
예제 #5
0
파일: bolt.py 프로젝트: moomoohk/py2neo
 def commit(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: RUN 'COMMIT' {}", self.local_port)
     log.debug("[#%04X] C: DISCARD_ALL", self.local_port)
     try:
         self._sync(self._write_request(0x10, "COMMIT", {}),
                    self._write_request(0x2F))
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(
             ConnectionBroken("Transaction broken by disconnection "
                              "during commit"), error)
     else:
         try:
             self._audit(self._transaction)
         except Neo4jError as error:
             tx.mark_broken()
             raise_from(ConnectionBroken("Failed to commit transaction"),
                        error)
         else:
             return Bookmark()
     finally:
         if callable(self._on_unbind):
             self._on_unbind(self._transaction)
예제 #6
0
 def rollback(self, tx):
     self._assert_transaction_open(tx)
     self._transactions.remove(tx)
     r = self._delete(tx.uri())
     assert r.status == 200  # TODO: other codes
     rs = HTTPResponse.from_json(r.data.decode("utf-8"))
     self.release()
     rs.audit(tx)
     return Bookmark()
예제 #7
0
파일: http.py 프로젝트: srlabUsask/py2neo
 def commit(self, tx):
     self._assert_valid_tx(tx)
     self._transactions.remove(tx)
     r = self._post(tx.commit_uri())
     assert r.status == 200  # TODO: other codes
     rs = HTTPResponse.from_json(r.data.decode("utf-8"))
     rs.audit()
     self.release()
     return Bookmark()
예제 #8
0
파일: bolt.py 프로젝트: jievince/py2neo
 def rollback(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: ROLLBACK", self.local_port)
     response = self._write_request(0x13)
     self._sync(response)
     self._audit(self._transaction)
     if callable(self._on_unbind):
         self._on_unbind(self._transaction)
     return Bookmark(response.metadata.get("bookmark"))
예제 #9
0
 def rollback(self, tx):
     self._assert_open()
     self._assert_open_transaction(tx)
     self._transaction.set_complete()
     log.debug("[#%04X] C: RUN 'ROLLBACK' {}", self.local_port)
     log.debug("[#%04X] C: DISCARD_ALL", self.local_port)
     self._sync(self._write_request(0x10, "ROLLBACK", {}),
                self._write_request(0x2F))
     self._audit(self._transaction)
     if callable(self._on_unbind):
         self._on_unbind(self._transaction)
     return Bookmark()
예제 #10
0
 def extra(self):
     extra = {}
     if self.graph_name:
         extra["db"] = self.graph_name
     if self.readonly:
         extra["mode"] = "r"
     if self.after:
         extra["bookmarks"] = list(Bookmark(self.after))
     if self.metadata:
         extra["metadata"] = self.metadata
     if self.timeout:
         extra["timeout"] = self.timeout
     return extra
예제 #11
0
 def rollback(self, tx):
     if tx.broken:
         raise ValueError("Transaction is broken")
     try:
         r = self._delete(tx.uri())
     except ProtocolError:
         tx.mark_broken()
         raise
     else:
         rs = HTTPResponse.from_json(r.status, r.data.decode("utf-8"))
         self.release()
         rs.audit(tx)
         return Bookmark()
예제 #12
0
파일: http.py 프로젝트: motey/py2neo
 def commit(self, tx):
     try:
         if tx.broken:
             raise ValueError("Transaction is broken")
         r = self._post(tx.commit_uri())
     except ProtocolError:
         tx.mark_broken()
         raise
     else:
         rs = HTTPResponse.from_json(r.status, r.data.decode("utf-8"))
         rs.audit(tx)
         return Bookmark()
     finally:
         self.release()
예제 #13
0
 def rollback(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     response = self.append_message(0x13)
     try:
         self._sync(response)
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(ConnectionBroken("Transaction broken by disconnection "
                                     "during rollback"), error)
     else:
         try:
             self._audit(self._transaction)
         except Neo4jError as error:
             tx.mark_broken()
             raise_from(ConnectionBroken("Failed to rollback transaction"), error)
         else:
             return Bookmark(response.metadata.get("bookmark"))
예제 #14
0
 def rollback(self, tx):
     self._assert_open()
     self._assert_transaction_open(tx)
     self._transaction.set_complete()
     try:
         self._sync(self.append_message(0x10, "ROLLBACK", {}),
                    self.append_message(0x2F))
     except BrokenWireError as error:
         tx.mark_broken()
         raise_from(ConnectionBroken("Transaction broken by disconnection "
                                     "during rollback"), error)
     else:
         try:
             self._audit(self._transaction)
         except Neo4jError as error:
             tx.mark_broken()
             raise_from(ConnectionBroken("Failed to rollback transaction"), error)
         else:
             return Bookmark()
예제 #15
0
 def commit(self, tx):
     if tx.broken:
         raise ValueError("Transaction is broken")
     try:
         r = self._post(tx.commit_uri())
     except ConnectionError as error:
         tx.mark_broken()
         raise_from(BrokenTransactionError("Transaction broken by disconnection "
                                           "during commit"), error)
     except HTTPError as error:
         tx.mark_broken()
         raise_from(BrokenTransactionError("Transaction broken by HTTP error "
                                           "during commit"), error)
     else:
         if r.status != 200:
             tx.mark_broken()
             raise BrokenTransactionError("Transaction broken by HTTP %d status "
                                          "during commit" % r.status)
         rs = HTTPResponse.from_json(r.status, r.data.decode("utf-8"))
         self.release()
         rs.audit(tx)
         return Bookmark()