During this week I have been working on an application that relies on Azure Blob Storage. In a few words the application run some processes and uploads the resulting files to Azure. The after each run, some files can change while other remains equal. In order to optimize the application JuanAr suggested adding logic to the application in order to upload only the changed files.
So I invested some time to implement what we called the SmartUploader. This class is very simple, it acts as a wrapper around the Azure Storage Client API. Each time this class uploads a file it calculates a checksum value and stores it in the blob metadata. So the next time before uploading the file it compares the current checksum of the file to upload with the checksum of the previously uploaded file and if it is the same the it avoids the upload because it means that the file has not changed.
The code snippet below shows the interesting part of the SmartUploader.
And here is the method that calculates the checksum.