当前位置: 首页>>代码示例>>Python>>正文


Python DatastoreDistributed.rollback_transaction方法代码示例

本文整理汇总了Python中appscale.datastore.datastore_distributed.DatastoreDistributed.rollback_transaction方法的典型用法代码示例。如果您正苦于以下问题:Python DatastoreDistributed.rollback_transaction方法的具体用法?Python DatastoreDistributed.rollback_transaction怎么用?Python DatastoreDistributed.rollback_transaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appscale.datastore.datastore_distributed.DatastoreDistributed的用法示例。


在下文中一共展示了DatastoreDistributed.rollback_transaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_rollback_transcation

# 需要导入模块: from appscale.datastore.datastore_distributed import DatastoreDistributed [as 别名]
# 或者: from appscale.datastore.datastore_distributed.DatastoreDistributed import rollback_transaction [as 别名]
 def test_rollback_transcation(self):
   db_batch = flexmock()
   db_batch.should_receive('valid_data_version').and_return(True)
   zookeeper = flexmock()
   zookeeper.should_receive("release_lock").and_return(True)
   zookeeper.should_receive("notify_failed_transaction").and_return(True)
   dd = DatastoreDistributed(db_batch, zookeeper)
   commit_request = datastore_pb.Transaction()
   commit_request.set_handle(123)
   commit_request.set_app("aaa")
   http_request = commit_request.Encode()
   self.assertEquals(dd.rollback_transaction("app_id", http_request),
                     (api_base_pb.VoidProto().Encode(), 0, ""))
开发者ID:menivaitsi,项目名称:appscale,代码行数:15,代码来源:test_datastore_server.py

示例2: test_rollback_transcation

# 需要导入模块: from appscale.datastore.datastore_distributed import DatastoreDistributed [as 别名]
# 或者: from appscale.datastore.datastore_distributed.DatastoreDistributed import rollback_transaction [as 别名]
  def test_rollback_transcation(self):
    db_batch = flexmock()
    db_batch.should_receive('valid_data_version_sync').and_return(True)

    zk_client = flexmock()
    zk_client.should_receive('add_listener')

    zookeeper = flexmock(handle=zk_client)
    zookeeper.should_receive("release_lock").and_return(True)
    zookeeper.should_receive("notify_failed_transaction").and_return(True)
    transaction_manager = flexmock()
    dd = DatastoreDistributed(db_batch, transaction_manager, zookeeper)
    commit_request = datastore_pb.Transaction()
    commit_request.set_handle(123)
    commit_request.set_app("aaa")
    self.assertEquals(
      dd.rollback_transaction("app_id", commit_request.handle()), None)
开发者ID:AppScale,项目名称:appscale,代码行数:19,代码来源:test_datastore_server.py


注:本文中的appscale.datastore.datastore_distributed.DatastoreDistributed.rollback_transaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。