private void Initialize() { if ((this.blobLocations.Count % 2) == 0) { throw new ArgumentException("Number of blob locations must be odd"); } foreach (var blobLocation in blobLocations) { string accountConnectionString = String.Format(Constants.ShortConnectioStringTemplate, ((this.useHttps == true) ? "https" : "http"), blobLocation.StorageAccountName, blobLocation.StorageAccountKey); try { CloudBlockBlob blob = CloudBlobHelpers.GetBlockBlob(accountConnectionString, blobLocation.BlobPath); this.blobs.Add(blobLocation.StorageAccountName + ';' + blobLocation.BlobPath, blob); } catch (Exception e) { ReplicatedTableLogger.LogError("Failed to init blob Acc={0}, Blob={1}. Exception: {2}", blobLocation.StorageAccountName, blobLocation.BlobPath, e.Message); } } int quorumSize = (this.blobLocations.Count / 2) + 1; if (this.blobs.Count < quorumSize) { throw new Exception(string.Format("Retrieved blobs count ({0}) is less than quorum !", this.blobs.Count)); } }
private void Initialize() { if ((this.blobLocations.Count % 2) == 0) { throw new ArgumentException("Number of blob locations must be odd"); } foreach (var blobLocation in blobLocations) { string accountConnectionString = String.Format(cloudStorageAccountTemplate, ((this.useHttps == true) ? "https" : "http"), blobLocation.StorageAccountName, blobLocation.StorageAccountKey); CloudBlockBlob blob = CloudBlobHelpers.GetBlockBlob(accountConnectionString, blobLocation.BlobPath); this.blobs.Add(blobLocation.StorageAccountName + ';' + blobLocation.BlobPath, blob); } this.quorumSize = (this.blobs.Count / 2) + 1; }