本文整理汇总了Python中appscale.datastore.datastore_distributed.DatastoreDistributed.delete_entities方法的典型用法代码示例。如果您正苦于以下问题:Python DatastoreDistributed.delete_entities方法的具体用法?Python DatastoreDistributed.delete_entities怎么用?Python DatastoreDistributed.delete_entities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.datastore.datastore_distributed.DatastoreDistributed
的用法示例。
在下文中一共展示了DatastoreDistributed.delete_entities方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_entities
# 需要导入模块: from appscale.datastore.datastore_distributed import DatastoreDistributed [as 别名]
# 或者: from appscale.datastore.datastore_distributed.DatastoreDistributed import delete_entities [as 别名]
def test_delete_entities(self):
app_id = 'test'
entity_proto1 = self.get_new_entity_proto(
app_id, "test_kind", "bob", "prop1name", "prop1val", ns="blah")
row_key = "test\x00blah\x00test_kind:bob\x01"
row_values = {row_key: {APP_ENTITY_SCHEMA[0]: entity_proto1.Encode(),
APP_ENTITY_SCHEMA[1]: '1'}}
zk_client = flexmock()
zk_client.should_receive('add_listener')
zookeeper = flexmock(handle=zk_client)
zookeeper.should_receive("get_valid_transaction_id").and_return(1)
db_batch = flexmock()
db_batch.should_receive('valid_data_version').and_return(True)
db_batch.should_receive("batch_get_entity").and_return(row_values)
db_batch.should_receive('batch_mutate')
db_batch.should_receive('_normal_batch')
transaction_manager = flexmock()
dd = DatastoreDistributed(db_batch, transaction_manager, zookeeper)
row_keys = [entity_proto1.key()]
dd.delete_entities(entity_proto1.key(), 1, row_keys)
示例2: test_delete_entities
# 需要导入模块: from appscale.datastore.datastore_distributed import DatastoreDistributed [as 别名]
# 或者: from appscale.datastore.datastore_distributed.DatastoreDistributed import delete_entities [as 别名]
def test_delete_entities(self):
app_id = 'test'
entity_proto1 = self.get_new_entity_proto(
app_id, "test_kind", "bob", "prop1name", "prop1val", ns="blah")
row_key = "test\x00blah\x00test_kind:bob\x01"
row_values = {row_key: {APP_ENTITY_SCHEMA[0]: entity_proto1.Encode(),
APP_ENTITY_SCHEMA[1]: '1'}}
zookeeper = flexmock()
zookeeper.should_receive("get_valid_transaction_id").and_return(1)
zookeeper.should_receive("register_updated_key").and_return(1)
db_batch = flexmock()
db_batch.should_receive('valid_data_version').and_return(True)
db_batch.should_receive("batch_get_entity").and_return(row_values)
db_batch.should_receive('batch_mutate')
dd = DatastoreDistributed(db_batch, zookeeper)
row_keys = [entity_proto1.key()]
txn_hash = {row_key: 1}
dd.delete_entities(app_id, row_keys, txn_hash)