Amazon S3 PHP SDK/API中的同步是否真的是同步操作? [英] Is Sync in Amazon S3 PHP SDK/API really a sync operation?

查看:57
本文介绍了Amazon S3 PHP SDK/API中的同步是否真的是同步操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Amazon php sdk( http使用以上链接的方法执行://docs.aws.amazon.com/aws-sdk-php/v3/guide/service/s3-transfer.html )同步操作.我已经成功地对其进行了编码和配置,但是在每次调用该方法时,由于未在本地对上一个同步调用进行修改,因此存储桶下文件的最后修改日期将更新为最新时间.

Amazon php sdk (http://docs.aws.amazon.com/aws-sdk-php/v3/guide/service/s3-transfer.html) sync operations are performed using the above linked methods. I've successfully coded and configured them, but on each call for the method the last modified date on files under the bucket gets updated to the latest time, given that the files were not modified locally to the previous sync call.

我想知道到底是同步操作还是只是覆盖本地目录发送的内容?

I wonder whether is it a sync operation at all or just overwriting operation of whatever is sent from the local directory?

这很重要的原因是我们计划在服务器和S3存储桶之间同步文件的演出.使用S3存储桶作为备份存储,万一发生任何中断,我们可以以相反的方式进行同步(S3存储桶->服务器),以使丢失的数据片段在我们的服务器中可用.

Why this matters is we are planning to sync gigs of files in between a server and S3 bucket. Using S3 buckets as backup storage, in case of any disruptions we can sync (S3 bucket -> server) the opposite way to make the missing pieces of data available in our server.

注释:

  1. 我也从

    推荐答案

    不幸的是,我相信答案是否定的,使用 Transfer 类时,我还看到每个文件的完整上传.

    Unfortunately I believe the answer is no, I also see complete upload of every file when using the Transfer class.

    v2

    客户端的 uploadDirectory()方法将比较以下内容:本地目录,仅用于Amazon S3存储桶中的内容传输已更改的文件.

    The uploadDirectory() method of a client will compare the contents of the local directory to the contents in the Amazon S3 bucket and only transfer files that have changed.

    完美,这就是我们想要的!

    Perfect, that's what we want!

    但是,我猜他们在 v3 中保留了 S3Client :: uploadDirectory()以实现API兼容性,但这是

    However, in v3 they have preserved S3Client::uploadDirectory() for API compatibility I guess, but it's just a wrapper for Transfer::promise(), which as we know just uploads without any syncing. Keeping API compatibility but changing behavior like this seems like a really bad idea to me.

    我最终不得不为我的项目添加支持,以使用AWS CLI工具进行实际上传,该工具确实完美支持同步.远非理想.

    I ended up having to add support to my project to use the AWS CLI tool for the actual uploading, which does support sync perfectly. Far from ideal.

    如果有一种方法可以使用 Transfer 类进行轻松同步而不是完全上传,则希望有人能证明我错了.

    If there is a way to use the Transfer class for easy syncing instead of complete uploading, I hope someone can prove me wrong.

    这篇关于Amazon S3 PHP SDK/API中的同步是否真的是同步操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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