Amazon S3 是否支持多文件原子上传?

发布于 2024-11-05 02:15:34 字数 313 浏览 1 评论 0原文

我正在开发一个针对 Amazon S3 的系统。 我正在使用 S3 的 .NET SDK 在 C# 中执行此操作。

我想一次将多个文件上传到 S3,但如果其中任何一个失败,我希望所有文件都失败。我可以这样做吗?如何?

SDK的TransferUtility.UploadDirectory是否对目录进行原子上传,如果目录中的任何文件上传失败,那么它们都会失败?

如果它不进行原子上传,那么我需要有代码来自己管理它;如何使用 TransferUtility.UploadDirectory 了解哪些文件成功,哪些文件失败?

感谢您的任何帮助或指导。

I'm developing a system against Amazon's S3.
I'm doing it in C# using S3's .NET SDK.

I want to upload several files to S3 at once but if any one fails I want all of them to fail. Can I do this? How?

Does the SDK's TransferUtility.UploadDirectory do an atomic upload of the directory, where if any file in the directory fails to upload then they all fail?

If it doesn't do atomic uploads then I'll need to have code to manage it myself; how do I learn about what files succeeded and which failed using the TransferUtility.UploadDirectory?

Thanks for any help or direction pointing.

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

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

发布评论

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

评论(2

倾城泪 2024-11-12 02:15:34

好吧,TransferUtility 方法似乎是相当高级的辅助类型方法,提供的反馈很少,并且 UploadDirectory 不包含任何原子性逻辑(S3 也不包含多个文件,这才是良好原子性真正需要发生的事情)。

因此,需要某种类型的最终一致性队列来确保事情能够完成。
S3 原子处理的多文件上传机制会非常方便,也许他们正在研究它,但他们目前似乎没有这个功能。

Well, it seems as though the TransferUtility methods are fairly high level helper type methods that provide little feedback, and UploadDirectory does not incorporate any atomicity logic (nor does S3 for multiple files, which is what would really need to happen for good atomicity).

So, some type of eventual consistency queues are needed to make sure things get done instead.
A multi-file upload mechanism for S3 to treat atomically would be very handy, and maybe they're working on it, but they don't seem to have this feature currently.

不及他 2024-11-12 02:15:34

不,你不能这样做。 S3不提供任何用于多对象上传的API。您能做的最好的事情就是在客户端中实现这一点(如果一次上传失败,则删除所有已上传的对象),但这当然不是原子的。

No, you can't do this. S3 does not offer any API for multi-object uploads. The best you can do is to implement this in your client (if one upload fails, remove all objects that have already been uploaded), but of course that's not atomic.

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