0
votes

Use Case :

i have to store request/response objects in Google Cloud Storage on daily basis, wanted to create folder on daily basis (bucket/year/month/day format) and store all the objects within current date/day. my typical flow is like below:

Json message to PubSub --> Cloud Function (Python) ---> Google Cloud storage on daily basis.

Query: Since Cloud Function can trigger parallel for each events in PubSub (millions of messages a day)and might create duplicate folders in GCS , is there any way to synchronise folder creation before creating object in GCS for given day?

1

1 Answers

1
votes

In Google Cloud Storage, the file name includes the full path (flat namespace).

For example, the name of a hypothetical file is "your-bucket/abc/file.tx" instead of just "file.txt"

Having said that, folders don't exist in cloud storage, you don't have to worry about creating folders or creating folders simultaneously, you only need to avoid to create files with the same name.