Minio.getObject()会自动使用Multipart下载大文件吗?
我们有一个创建新文件的生成器流程,其中一个大小超过6GB。
消费者进程在并行中读取这些文件(更多信息)。
使用AWS S3 CP ...
从我的计算机进行测试,我几乎总是会收到一个混乱的文件 - 一个带有一些旧数据和一些新数据的文件,因为我的Internet连接太慢了一口气下载整个文件。
发生这种情况是因为复制命令使用多部分功能。
但是,我们的消费者过程是用GO编写的,它使用 <代码> getObject()来自Minio库。阅读文档和进行搜索并未提及有关在getObject()
上使用Multipart的任何内容。它显然为您提供了A putobject())
:
minio.putobjectOptions
指向结构的指针,允许用户设置可选的自定义元数据,内容类型,内容编码,内容分配,内容语言和缓存控制标头,通过加密模块加密对象以及 objoipt多部分的线程put操作。
下载大文件时,getObject()
是否会自动使用多部分?
这是我们用来读取数据的代码的基本行,而没有所有错误处理等:
mc, _ := minio.New(s3Endpoint, &minio.Options{})
s3, _ := mc.GetObject(ctx, bucket, filename,
minio.GetObjectOptions{})
var data map[string]SomeStruct
json.NewDecoder(s3.reader).Decode(&data)
We have a generator process that creates new files, one of which is over 6Gb in size.
The consumer process reads those files in parallel (more info).
Testing with aws s3 cp ...
from my computer, I pretty much always get a mangled file—a file with some of the old data and some of the new data—because my Internet connection is too slow to download the whole file in one go.
This happens because the copy command uses the multipart feature.
Our consumer process, though, is written in Go and it uses GetObject()
from minio library. Reading the documentation and doing searches does not mention anything about using multipart on a GetObject()
. It clearly gives you the option on a PutObject()
:
minio.PutObjectOptions
Pointer to struct that allows user to set optional custom metadata, content-type, content-encoding, content-disposition, content-language and cache-control headers, pass encryption module for encrypting objects, and optionally configure number of threads for multipart put operation.
Is the GetObject()
automatically using multipart when downloading large files?
Here are the basic lines of code that we use to read the data, without all the error handling and such:
mc, _ := minio.New(s3Endpoint, &minio.Options{})
s3, _ := mc.GetObject(ctx, bucket, filename,
minio.GetObjectOptions{})
var data map[string]SomeStruct
json.NewDecoder(s3.reader).Decode(&data)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论