简体   繁体   English

GCP 存储 - 锁定存储在 GCP 存储桶中的对象/文件

[英]GCP storage - lock object/file stored in GCP bucket

I am getting a data file from source system.我正在从源系统获取数据文件。 once file received in GCP bucket we start processing that file.一旦在 GCP 存储桶中收到文件,我们就开始处理该文件。 How to lock this file till the processing is completed?如何锁定这个文件直到处理完成? so no other file processor (app) can process this file if it is locked/in processing.因此,如果该文件被锁定/正在处理,则没有其他文件处理器(应用程序)可以处理该文件。

There is no way to lock a Google Cloud Storage bucket or object. But, You can use Preconditions to prevent race conditions.无法锁定 Google Cloud Storage 存储桶或 object。但是,您可以使用前提条件来防止竞争条件。

Preconditions are often used to prevent race conditions in mutating requests, such as uploads, deletes, or metadata updates.前提条件通常用于防止变异请求中的竞争条件,例如上传、删除或元数据更新。 Race conditions can arise when the same request is sent repeatedly or when independent processes each attempt to modify the same resource.当相同的请求被重复发送或当独立进程各自尝试修改相同的资源时,可能会出现竞争条件。 See Examples of race conditions and data corruption for more information.有关更多信息,请参阅竞争条件和数据损坏的示例。 Preconditions are also often used when retrieving object metadata and data in successive requests, to ensure the object did not change in the time between the two requests.在连续请求中检索 object 元数据和数据时也经常使用前置条件,以确保 object 在两次请求之间没有发生变化。

You may have a lock at this thread您可能已锁定此线程

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

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