如何从应用程序引擎附加写入谷歌云存储文件? [英] How to append write to google cloud storage file from app engine?

查看:97
本文介绍了如何从应用程序引擎附加写入谷歌云存储文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此弃用的API支持将内容附加到Google云存储文件:

  FileWriteChannel FileService.openWriteChannel(AppEngineFile文件,$ b $ 
$ / code>

但是,

<$ p $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ G $



这里的解决方案是什么?

解决方案



正如 Cloud Services文档 对象不可变



对象是不可变的,这意味着上传的对象在其整个存储生命周期中不能改变。对象的存储生命周期是成功创建对象(上载)和成功删除对象之间的时间。实际上,这意味着您不能对对象进行增量更改,例如追加操作或截断操作。但是,可以覆盖存储在Google Cloud Storage中的对象,因为覆盖操作实际上是删除对象操作,随后是上载对象操作。因此,单个覆盖操作只会标记一个不可变对象的生命周期的结束以及新不可变对象的生命周期的开始。


This deprecated API supports appending content to google cloud storage file:

FileWriteChannel FileService.openWriteChannel(AppEngineFile file,
                                boolean lock)

But,

GcsOutputChannel GcsService.createOrReplace(GcsFilename filename,
                               GcsFileOptions options)

doesn't seem so.

What is the solution here?

解决方案

Sorry to tell you but it cannot be done without replacing the file each time.

As stated in the Cloud Services docs Under Object immutability

Objects are immutable, which means that an uploaded object cannot change throughout its storage lifetime. An object's storage lifetime is the time between successful object creation (upload) and successful object deletion. In practice, this means that you cannot make incremental changes to objects, such as append operations or truncate operations. However, it is possible to overwrite objects that are stored in Google Cloud Storage because an overwrite operation is in effect a delete object operation followed immediately by an upload object operation. So a single overwrite operation simply marks the end of one immutable object's lifetime and the beginning of a new immutable object's lifetime.

这篇关于如何从应用程序引擎附加写入谷歌云存储文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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