Luke Puplett
Luke Puplett

Reputation: 45105

Efficiently check if any items have changed in a Google Storage bucket?

Is there a quick way to check if anything has changed in a storage bucket?

The bucket has an ETag but I think this is just for the bucket's own object data and has nothing to do with the bucket contents.

I'm looking for some kind of changing version entropy for its contents.

Upvotes: 2

Views: 1345

Answers (1)

John Hanley
John Hanley

Reputation: 81336

One method is to read the generation property. An object version's generation value never changes. A new object with the same name can replace an existing object, but the new object always has a different generation assigned to it.

Generation and metageneration numbers

Note: Google Cloud Storage objects cannot be modified. The only method to update an object is to replace it. Therefore the generation property is a guaranteed method to detect that an object has been modified. Note: I am not referring to object metadata, just the object's contents.

I have written commercial software that synchronized storage between local systems and multiple cloud vendors. I used multiple methods to detect which objects need to be updated (synchronized). Object metadata, custom metadata headers, and hashing contents. The best answer depends on exactly what your need to accomplish and how you are managing the comparison data.

Upvotes: 2

Related Questions