public AppLeaseManager( AzureStorageClient azureStorageClient, IPartitionManager partitionManager, string appLeaseContainerName, string appLeaseInfoBlobName, AppLeaseOptions options) { this.azureStorageClient = azureStorageClient; this.partitionManager = partitionManager; this.appLeaseContainerName = appLeaseContainerName; this.appLeaseInfoBlobName = appLeaseInfoBlobName; this.options = options; this.storageAccountName = this.azureStorageClient.BlobAccountName; this.settings = this.azureStorageClient.Settings; this.taskHub = settings.TaskHubName; this.workerName = settings.WorkerId; this.appName = settings.AppName; this.appLeaseIsEnabled = this.settings.UseAppLease; this.appLeaseContainer = this.azureStorageClient.GetBlobContainerReference(this.appLeaseContainerName); this.appLeaseInfoBlob = this.appLeaseContainer.GetBlobReference(this.appLeaseInfoBlobName); var appNameHashInBytes = BitConverter.GetBytes(Fnv1aHashHelper.ComputeHash(this.appName)); Array.Resize(ref appNameHashInBytes, 16); this.appLeaseId = new Guid(appNameHashInBytes).ToString(); this.isLeaseOwner = false; this.shutdownCompletedEvent = new AsyncManualResetEvent(); }
public AppLeaseManager( AzureStorageOrchestrationServiceSettings settings, string accountName, CloudBlobClient storageClient, string appLeaseContainerName, AppLeaseOptions options, AzureStorageOrchestrationServiceStats stats) { this.settings = settings; this.accountName = accountName; this.taskHub = settings.TaskHubName; this.workerName = settings.WorkerId; this.storageClient = storageClient; this.appLeaseContainerName = appLeaseContainerName; this.appName = settings.AppName; this.options = options; this.stats = stats ?? new AzureStorageOrchestrationServiceStats(); this.isLeaseOwner = false; this.appLeaseContainer = this.storageClient.GetContainerReference(this.appLeaseContainerName); using (MD5 md5 = MD5.Create()) { byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(this.appName)); this.appLeaseId = new Guid(hash).ToString(); } }
public AppLeaseManager( AzureStorageClient azureStorageClient, IPartitionManager partitionManager, string appLeaseContainerName, string appLeaseInfoBlobName, AppLeaseOptions options) { this.azureStorageClient = azureStorageClient; this.partitionManager = partitionManager; this.appLeaseContainerName = appLeaseContainerName; this.appLeaseInfoBlobName = appLeaseInfoBlobName; this.options = options; this.storageAccountName = this.azureStorageClient.StorageAccountName; this.settings = this.azureStorageClient.Settings; this.taskHub = settings.TaskHubName; this.workerName = settings.WorkerId; this.appName = settings.AppName; this.appLeaseIsEnabled = this.settings.UseAppLease; this.appLeaseContainer = this.azureStorageClient.GetBlobContainerReference(this.appLeaseContainerName); this.appLeaseInfoBlob = this.appLeaseContainer.GetBlobReference(this.appLeaseInfoBlobName); using (MD5 md5 = MD5.Create()) { byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(this.appName)); this.appLeaseId = new Guid(hash).ToString(); } this.isLeaseOwner = false; this.shutdownCompletedEvent = new AsyncManualResetEvent(); }