如何在Firebase Storage中启用和使用文件版本控制? [英] How to enable and use file versioning in Firebase Storage?

查看:60
本文介绍了如何在Firebase Storage中启用和使用文件版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firebase存储基于Google Cloud Platform,它允许文件版本.

Firebase storage is based on Google Cloud Platform which allows versioning of files.

在Firebase控制台中,没有关于GCP存储桶的选项,并且在访问GCP控制台时,似乎没有办法在与Firebase项目相关的存储桶中启用版本控制.

In the Firebase console there are no options regarding the GCP bucket, and when accessing the GCP console, there doesn't seem to be a way on enabling versioning in the bucket pertaining to the Firebase project.

此外,即使启用了版本控制,Firebase SDK也没有提及如何访问文件的早期版本.

Also, the Firebase SDK does not mention how to access previous versions of files even if versioning was enabled.

Firebase Storage是否可以进行版本控制?

Is versioning possible with Firebase Storage?

推荐答案

Firebase存储基于GCS构建,因此可以通过Firebase存储访问GCS的许多功能. Firebase存储还共享一个名为<project-id>.appspot.com(或类似名称)的GCS存储桶,可以通过Firebase控制台和Cloud控制台进行访问.

Firebase Storage is built on GCS so many of the features of GCS can be accessed via Firebase Storage. Firebase Storage also shares a GCS bucket named <project-id>.appspot.com (or similar), that can be accessed via both the Firebase console and the Cloud console.

您可以使用 gsutil 工具(可能是最简单的方法):

You can enable object versioning on your bucket by using the gsutil tool (probably the easiest way) like so:

gsutil versioning set on gs://<project-id>.appspot.com

也就是说,除了最新版本外,无法使用Firebase Storage客户端检索其他内容.这是有意为之的,因为Firebase Storage提供了GCS API的一个更简单,以移动设备为重点的子集,而且我们没有超级引人注目的用例来为移动设备提供直观的对象版本控制故事.每个用户的数据备份(由用户在没有开发人员干预的情况下启动)和文档差异是我可以想到的两个,但是如果您有另一个,我们很乐意听到:)

That said, there's no way of using the Firebase Storage clients to retrieve anything other than the most recent version. This was intentional, since Firebase Storage provides a simpler, mobile focused subset of the GCS APIs, and we didn't have a super compelling use case for providing an intuitive object versioning story for mobile. Per user data backups (initiated by the user without dev intervention), and document diffs are the two I can think of, but if you've got another, we'd love to hear it :)

我们希望大多数开发人员都会启用此功能,以防止永久删除操作(实际上,我们在

We anticipate that a majority of devs will turn this on in order to prevent deletions from being permanent (and indeed, we mention doing this in our delete docs), and will thus use tools like gsutil or their own custom backends to retrieve and restore the appropriate files.

编辑10/1:由于这些用例变得越来越普遍,因此我们更新了文档,在

EDIT 10/1: Since these use cases have become more common, we've updated our docs to include more things you can do with Google Cloud Platform in our GCP Integration guide.

这篇关于如何在Firebase Storage中启用和使用文件版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆