Google Cloud Datastore Emulator 如何验证我们的 datastore-index.xml?

Posted

技术标签:

【中文标题】Google Cloud Datastore Emulator 如何验证我们的 datastore-index.xml?【英文标题】:How can the Google Cloud Datastore Emulator verify our datastore-index.xml? 【发布时间】:2019-01-12 11:31:20 【问题描述】:

我们使用Google Cloud Datastore Emulator。它自动生成indexes.yaml。但正如我们使用旧的 Eclipse 谷歌插件所做的那样,我们希望在本地开发环境中获取缺失索引消息,而不是稍后在云部署中。所以,我们希望模拟器使用我们手动维护的datastore-indexes.xml

我们如何在 Google Cloud Datastore Emulator 中配置特定 datastore-indexes.xml 的使用?我在帮助文本中没有看到任何相关的命令行开关。

【问题讨论】:

【参考方案1】:

编辑

我的答案是基于 dev_appserver 模拟器,而不是当前的。运行一些测试后,模拟器似乎只有subset of the Datastore API methods 的端点,并且索引构建(也不是导出/导入)可用。

留下我之前的答案,以避免重复回答相同的错误信息:

_________

根据the docs,如果autoGenerate="false"在你的datastore-indexes.xml中,开发服务器应该忽略WEB-INF/appengine-generated/datastore-indexes-auto.xml的内容。

我认为这可能是您正在寻找的,虽然我还没有测试过。

【讨论】:

谢谢。这似乎相关,但指的是 GCP 中的 Datastore,而不是 Cloud Emulator。模拟器查看 index.yaml 并且永远不会在 datastore-indexes.xml 中看到指令。那么我们如何让 Emulator 来查看 , datastore-indexes*.xml 呢。 文档状态下的语句:“如果 autoGenerate="false" 在您的 datastore-indexes.xml 中,则 开发服务器 和 AppCfg 会忽略 datastore-indexes 的内容-auto.xml。” (强调我的)。我认为它可以与模拟器一起使用,但它也可能无法正常工作。你试过了吗? GAE 开发服务器(已过时的 Eclipse 云工具的一部分)使用 datastore-indexes.xml。较新的 Cloud Datastore Emulator 没有。我们如何将模拟器指向 datastore-indexes.xml? 看起来the code 正在寻找datastore-indexes.xml 文件,所以我不确定发生了什么。 我一直在检查新的数据存储模拟器,它看起来不像可以接受索引。显然,它只接受subset of the Cloud Datastore API methods,而创建索引不是其中之一。它确实会生成一个 index.yaml,因此您可以在云中创建这些索引,但它目前似乎不能接受任何手动索引。

以上是关于Google Cloud Datastore Emulator 如何验证我们的 datastore-index.xml?的主要内容,如果未能解决你的问题,请参考以下文章

Google Cloud Datastore 客户端库创建实体

在 Google Cloud Datastore 上使用动态类型

Google Cloud Datastore Emulator 如何验证我们的 datastore-index.xml?

无法连接到本地 Google Cloud Datastore 模拟器

抛开价格不谈,为啥要选择 Google Cloud Bigtable 而不是 Google Cloud Datastore?

在 Google Cloud Datastore 与 Google Cloud Bigtable 中存储用户事件历史记录