Search code examples
lockinggoogle-cloud-storagefile-locking

Is it possible to lock a bucket for writes?


I am looking to develop a sync solution on google cloud storage. Does GCS offer a locking mechanism so a bucket won't be written to concurrently, and if so, what protections against deadlocks does it have?


Solution

  • There is no way to lock a Google Cloud Storage bucket or object.

    You can, however, use an object's generation, metageneration and preconditions to achieve optimistic concurrency. See Generation Numbers and Preconditions for details.