Locking with S3

前端 未结 2 577
小鲜肉
小鲜肉 2020-12-23 22:01

What\'s the recommended way to implement a simple locking mechanism to be used in conjunction with S3?

Example of what I want to do:

  • acquire lock by ob
2条回答
  •  一个人的身影
    2020-12-23 22:42

    i dont think that you can do this using S3 only, using simpleDB's consistency enhancements as james said is a good way that works

    you can look for some examples here : Amazon SimpleDB Consistency Enhancements

    another approach that might be fine is using the versioning feature of S3
    so basically, store an object id/version id pair in simpleDB as the most "valid" version
    and assure that all GET requests will retrieve that version
    after a successful PUT of a modified object, update the version id in the DB

    this way you could also use the ability to retrieve previous versions of an object for restoring if needed.

提交回复
热议问题