简体   繁体   English

库appengine.api.datastore和com.google.cloud.datastore有什么区别?

[英]What is the difference between libraries appengine.api.datastore and com.google.cloud.datastore?

I am developing an appengine project and storing my data using Google Datastore. 我正在开发一个appengine项目并使用Google Datastore存储我的数据。 I am using different Datastore libraries as they are the ones used in the examples, but I find it kind of weird that I have to use both: 我使用不同的数据存储库,因为它们是示例中使用的,但我觉得有点奇怪,我必须使用它们:

If I check the docs for querying, in this example they use this library to process queries: 如果我检查用于查询的文档,在此示例中,他们使用此库来处理查询:

com.google.appengine.api.datastore 的列举

https://cloud.google.com/appengine/docs/java/datastore/retrieving-query-results https://cloud.google.com/appengine/docs/java/datastore/retrieving-query-results

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); PreparedQuery pq = datastore.prepare(q); PreparedQuery pq = datastore.prepare(q); Entity result = pq.asSingleEntity(); 实体结果= pq.asSingleEntity();

However, in this example to store data, they use 但是,在这个例子中存储数据,他们使用

com.google.cloud.datastore com.google.cloud.datastore

https://cloud.google.com/datastore/docs/concepts/entities https://cloud.google.com/datastore/docs/concepts/entities

Entity task = Entity.builder(taskKey) .set("category", "Personal") .set("done", false) .set("priority", 4) .set("description", "Learn Cloud Datastore") .build(); 实体任务= Entity.builder(taskKey).set(“category”,“Personal”)。set(“done”,false).set(“priority”,4).set(“description”,“Learn Cloud Datastore” ).build();

Right now I am able to use both but I am wondering which one is better for which kind of purpose or if they are just the same libraries with different packages. 现在我可以使用两者,但我想知道哪一个更好用于哪种目的,或者它们是否只是具有不同包的相同库。 However, I am looking for a way to remove one of them. 但是,我正在寻找一种方法来删除其中一个。

com.google.appengine.api.datastore - is specifically designed to work from Apps deployed on AppEngine. com.google.appengine.api.datastore - 专门设计用于在AppEngine上部署的应用程序。 The API does not work if you later decide to deploy your App elsewhere (eg Compute Engine). 如果您以后决定在其他地方部署您的应用程序(例如,计算引擎),则API不起作用。

com.google.cloud.datastore - is the new API that allows you to access Datastore from Apps deployed anywhere, not just AppEngine. com.google.cloud.datastore - 是一种新的API,允许您从任何地方部署的应用程序访问数据存储,而不仅仅是AppEngine。

com.google.appengine.api.datastore - has some additional features that the other one does not have (at least not yet). com.google.appengine.api.datastore - 有一些额外的功能,另一个没有(至少还没有)。 For example, OR condition in your Datastore queries, ability to integrate with other AppEngine Services such as MemCache, FullText Search, etc. 例如,数据存储区查询中的OR条件,与MemCache,FullText Search等其他AppEngine服务集成的能力。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.google.datastore.v1 和 com.google.cloud.datastore 之间的区别/缺少禁用索引的选项 - Difference between com.google.datastore.v1 and com.google.cloud.datastore / Missing option to disable index 如何在Eclipse中导入com.google.cloud.datastore? - How to import com.google.cloud.datastore in Eclipse? AppEngine ClassNotFoundException:com.google.appengine.api.datastore.DatastoreServiceFactory - AppEngine ClassNotFoundException: com.google.appengine.api.datastore.DatastoreServiceFactory 如何在数据库中存储“ com.google.appengine.api.datastore.Text” - How to store “com.google.appengine.api.datastore.Text” in database 将属性设置为com.google.appengine.api.datastore.Entity - Setting a property to com.google.appengine.api.datastore.Entity 如何使用com.google.appengine.api.datastore.Text - how to use com.google.appengine.api.datastore.Text com.google.appengine.api.datastore.DatastoreNeedIndexException:找不到匹配的索引 - com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found com.google.appengine.api.datastore.DatastoreFailureException:意外失败 - com.google.appengine.api.datastore.DatastoreFailureException: Unexpected failure 示例应用中的com.google.appengine.api.datastore.DatastoreNeedIndexException错误 - com.google.appengine.api.datastore.DatastoreNeedIndexException error in Sample App java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/AsyncDatastoreService - java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/AsyncDatastoreService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM