2017-03-18 88 views
1

Google App Engine有兩種不同的數據存儲包: google.golang.org/appengine/datastorecloud.google.com/go/datastore是否可以在GAE flex環境中使用appengine/datastore包?

The documentation爲appengine/datastore包使用標準環境,而the documentation爲雲包使用flex環境。

我有一個Go應用程序,它在標準GAE環境中使用appengine/datastore包。如果我想將此應用程序從標準環境遷移到柔性環境,是否需要切換到cloud.google.com/go/datastore包,還是可以繼續使用appengine/datastore包?如果不是,爲什麼不呢?

回答

1

您需要遷移到cloud.google.com/go/datastore。

Migrating Services from the Standard Environment to the Flexible Environment

App Engine的靈活的環境並沒有提供API庫 目前在App Engine SDK。如果您使用decide to migrate your application from the App Engine standard environment to the flexible environment,則必須更新代碼以使用可在所有Google雲端平臺環境中使用的服務和API 。

而且從Cloud Datastore

您可以使用 雲存儲API隨時隨地訪問Google Cloud Datastore。使用Google Cloud client libraries至 存儲並從雲數據存儲檢索數據。

無論您是使用 App Engine庫還是Google Cloud客戶端庫,還是直接調用 API,都可以使用相同的Cloud Datastore數據。

這時ORM庫,在標準環境 如ndbObjectify可用不支持 標準環境之外。

有關詳細信息,請參閱下列指南: