简体   繁体   English

我可以使用aws-sdk-ruby在AWS S3上使用事务文件删除/上传吗?

[英]Can I use transactional file remove/upload on AWS S3 with aws-sdk-ruby?

I find ActiveRecord::Base.transaction very effective in complex methods. 我发现ActiveRecord::Base.transaction在复杂方法中非常有效。

I was wondering if its possible to upload/remove files from AWS S3 within a transaction like: 我想知道是否可以在以下事务中从AWS S3上传/删除文件:

S3Object.transaction do
   # write into files
   # raise an exception
end

After the exception is raised every action should be rolled back on S3. 引发异常后,应在S3上回滚每个操作。 Is this possible with S3Object ? 这对S3Object有可能吗?

Although the S3 API has a bulk delete functionality, it does not support transactions as each delete operation can succeed/fail independently of the others. 虽然S3 API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。

The API does not provide any bulk upload functionality (through PUT or POST) so each upload operation is done through an independent API call that can succeed or fail. API不提供任何批量上传功能(通过PUT或POST),因此每次上传操作都是通过可以成功或失败的独立API调用完成的。

As a result, the Ruby API client or any other API clients can not provide any transactional support for S3 operations. 因此,Ruby API客户端或任何其他API客户端无法为S3操作提供任何事务支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM