Alexander Marquardt
Alexander Marquardt

Reputation: 1539

Is google cloud storage object versioning compatible with appengine cloud storage client library?

I am looking to back up user-generated data (user profiles, that may change from time to time) from my AppEngine python application into Google Cloud Storage. I could easily periodically brute-force back up all of the user-generated data, but it probably makes more sense to only update data that has changed (only writing it to the cloud storage if the user has changed their data). Later, in the case that data needs to be restored, I would like to take advantage of the object-versioning functionality of the Cloud Storage service to determine which objects need to be restored.

I am trying to understand exactly how the google cloud storage interacts with AppEngine based on the information regarding cloudstorage.open() found at https://developers.google.com/appengine/docs/python/googlecloudstorageclient/functions. However, there is no indication of how this service interacts with versioned objects that are stored in the cloud (versioned objects are documented here: https://developers.google.com/storage/docs/object-versioning).

So, my question is: how can an application running on the AppEngine access specific versions of objects that are stored in Google Cloud Storage.

If there is a better way of doing this, I would be interested in hearing about it as well.

Upvotes: 0

Views: 756

Answers (1)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38389

The AppEngine GCS Client Library doesn't support versioning at this time. If you enable versioning on a bucket through other channels, the GCS Client Library will keep working fine, but in order to access or delete older generations of objects, you'll need to use either the XML API or the JSON API (as opposed to the appengine-specific API). There is a Python client for the JSON API that works fine from within appengine, but you'll lose a few of appengine's niceties by using it. See https://developers.google.com/appengine/docs/python/googlecloudstorageclient/#gcs_rest_api for more details.

Here's a bit of info on how to use versioning from the XML and JSON APIs: https://developers.google.com/storage/docs/generations-preconditions

Upvotes: 3

Related Questions