将文件从 gcs 存储桶复制到另一个存储桶时如何保留生成编号

发布于 2025-01-17 08:10:07 字数 284 浏览 2 评论 0原文

我正在为 WordPress 使用 gcs 存储桶(wp-stateless 插件) 创建媒体文件并将其上传到存储桶后。我将其复制到其他存储桶(重复)。但是每个对象的生成数已经改变(可能是随机的)。

我的问题是:如何使生成编号与目标存储桶中的存储桶源相同? 世代编号对象

提前致谢。

I'm using gcs bucket for wordpress (wp-stateless plugin)
after create and upload media file to a bucket. I copy it to other bucket (duplicate). But generation number of each object has been change (maybe random).

My question is: How to keep generation number same bucket source like in destination bucket?
generation number of object

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘然心甜 2025-01-24 08:10:07

基本上,在将文件从一个存储桶复制到另一个存储桶时,没有一种官方方法可以保持相同的版本和代号。这是 WAI 且直观的,因为版本号引用此对象(驻留在此存储桶上),当您将其复制到另一个存储桶时,它不是同一个对象(它是副本),因此它不能保持相同的 版本号

我可以想到一个解决方法,将您自己的对象版本保存在某个地方,然后通过 API 制作一个有组织的副本。这意味着您将转储存储桶,但您需要拥有所有对象及其版本的列表,然后按顺序添加它们(听起来像是很多工作)。您可以在每个对象的元数据中保留自己的版本控制(或相同的版本控制)。

如果您的应用程序依赖于对象的版本控制,我建议您使用自定义元数据。基本上,如果您使用自定义元数据进行自己的版本控制,则将对象复制到新存储桶时,它将保留相同的元数据。

已经有一个关于此问题的功能请求。但是,它提到目前这是不可行的。

不过,您可以在此处

Basically, there’s not an official way of keeping the same version and generation numbers when copying files from one bucket to another. This is WAI and intuitive because the version number refers to this object (which resides on this bucket), when you copy it to another bucket, it's not the same object (it's a copy) so it cannot keep the same version number.

I could think of a workaround, keeping somewhere your own version of the objects and then through the API make an organized copy. This would mean you would be dumping the bucket but you would need to have a list of all the objects and its versions and then add them in sequential order (sounds like a lot of work). You could keep your own versioning (or the same versioning) in the metadata of each object.

I would recommend that if your application depends on the object’s versioning, to use custom metadata. Basically, if you did your own versioning using custom metadata, when copying the objects to a new bucket, it would keep the same metadata.

There is already a feature request created about this. But, it has mentioned that it's currently infeasible.

However, you can raise a new feature request here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文