如何将文件存储在 Google Storage 上,但跳过 GAE 部分来获取它们?
我喜欢 Google App Engine 的数据存储区(事实上我可以用 Python 进行开发),但他们有 获取和上传文件的限制为 1MB。另一方面,我猜它并不是为此而设计的。
我设法创建了一项服务,该服务获取 URL(或来自用户的文件),在 GAE 上获取它,然后将其放入 Google Storage。工作得很好,但对于小于 1MB 的文件。有解决方法 当然,但我认为通过跳过 GAE 进行数据检索来加快速度应该是可行的。
所以我的问题是:是否可以将我的数据存储保留在 GAE 上,并且只知道 URL(或上传文件的特殊形式)创建标头,然后让 Google Storage 获取文件并存储它,而没有 1MB 的限制?
I like Google App Engine for the Datastore (and the fact that I can develop in Python) but they have 1MB limits on fetching and uploading files. On the other hand it wasn't made for that I guess.
I managed to create a service that is getting a URL (or a file from user), fetching it on GAE and then putting it on Google Storage. Works perfectly fine, but for files that are less than 1MB. There are workarounds of course, but I think it should be feasible to do it faster by skipping the GAE for data retrieval.
So my question is: Is it possible to keep my datastore on GAE and by knowing only the URL (or a special form to upload files) create the headers and then letting Google Storage to fetch the file and store it without the 1MB limit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可以。Google Storage 不支持为您提取文件。
No. Google Storage doesn't support fetching the file for you.
文件存储在哪里并不重要。不仅存在 1MB 数据存储实体大小限制,而且存在 1MB 内存数据结构限制。因此,即使您将文件存储在其他位置,您也必须将其分成多个部分才能在应用程序引擎上对其进行操作。
对于 GAE 上的 Java,我建议查看 gaevfs (http://code.google.com/p/gaevfs/)。它将应用程序引擎数据存储区转换为一个文件系统,可以存储任意大小的文件并像普通文件一样对其进行操作。
It doesn't matter where the file is stored. Not only is there a 1MB datastore entity size limit, but there is a 1MB in-memory datastructure limit. So even if you stored the file somewhere else, you would have to split it into pieces to be able to operate on it on the app engine.
For Java on the GAE, I suggest looking at gaevfs (http://code.google.com/p/gaevfs/). It turns the app engine datastore into a filesystem that can store files of arbitrary size and operate on them just as normal files.