Skip to content

Commit

Permalink
Non-functional code-style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cgillum committed Nov 20, 2018
1 parent 5ef1a38 commit 0d67574
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 53 deletions.
10 changes: 5 additions & 5 deletions src/DurableTask.AzureStorage/BackoffPollingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class RandomizedExponentialBackoffStrategy
{
public const double RandomizationFactor = 0.2;

private readonly TimeSpan minimumInterval;
private readonly TimeSpan maximumInterval;
private readonly TimeSpan deltaBackoff;
readonly TimeSpan minimumInterval;
readonly TimeSpan maximumInterval;
readonly TimeSpan deltaBackoff;

private uint backoffExponent;
private Random random;
uint backoffExponent;
Random random;

public RandomizedExponentialBackoffStrategy(TimeSpan minimumInterval, TimeSpan maximumInterval)
: this(minimumInterval, maximumInterval, minimumInterval)
Expand Down
49 changes: 49 additions & 0 deletions src/DurableTask.AzureStorage/PurgeHistoryResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// ----------------------------------------------------------------------------------
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace DurableTask.AzureStorage
{
/// <summary>
/// Class to hold statistics about this execution of purge history
/// </summary>
public class PurgeHistoryResult
{
/// <summary>
/// Constructor for purge history statistics
/// </summary>
/// <param name="storageRequests">Requests sent to storage</param>
/// <param name="instancesDeleted">Number of instances deleted</param>
/// <param name="rowsDeleted">Number of rows deleted</param>
public PurgeHistoryResult(int storageRequests, int instancesDeleted, int rowsDeleted)
{
this.StorageRequests = storageRequests;
this.InstancesDeleted = instancesDeleted;
this.RowsDeleted = rowsDeleted;
}

/// <summary>
/// Number of requests sent to Storage during this execution of purge history
/// </summary>
public int StorageRequests { get; }

/// <summary>
/// Number of instances deleted during this execution of purge history
/// </summary>
public int InstancesDeleted { get; }

/// <summary>
/// Number of rows deleted during this execution of purge history
/// </summary>
public int RowsDeleted { get; }
}
}
14 changes: 7 additions & 7 deletions src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace DurableTask.AzureStorage.Tracking
using Newtonsoft.Json;

/// <summary>
/// Tracking store for use with the AzureStorageOrxhestration Service. Uses azure table and blob storage to store runtime state.
/// Tracking store for use with <see cref="AzureStorageOrchestrationService"/>. Uses Azure Tables and Azure Blobs to store runtime state.
/// </summary>
class AzureTableTrackingStore : TrackingStoreBase
{
Expand Down Expand Up @@ -269,7 +269,7 @@ public override async Task<bool> ExistsAsync()
};
}

private async Task<List<DynamicTableEntity>> QueryHistoryAsync(string filterCondition, string instanceId, CancellationToken cancellationToken)
async Task<List<DynamicTableEntity>> QueryHistoryAsync(string filterCondition, string instanceId, CancellationToken cancellationToken)
{
TableQuery query = new TableQuery().Where(filterCondition.ToString());

Expand Down Expand Up @@ -490,7 +490,7 @@ public override async Task<OrchestrationState> GetStateAsync(string instanceId,
return this.ConvertFromAsync(orchestrationInstanceStatus, instanceId);
}

private OrchestrationState ConvertFromAsync(OrchestrationInstanceStatus orchestrationInstanceStatus, string instanceId)
OrchestrationState ConvertFromAsync(OrchestrationInstanceStatus orchestrationInstanceStatus, string instanceId)
{
var orchestrationState = new OrchestrationState();
if (!Enum.TryParse(orchestrationInstanceStatus.RuntimeStatus, out orchestrationState.OrchestrationStatus))
Expand Down Expand Up @@ -539,7 +539,7 @@ private OrchestrationState ConvertFromAsync(OrchestrationInstanceStatus orchestr
cancellationToken);
}

private async Task<DurableStatusQueryResult> QueryStateAsync(TableQuery<OrchestrationInstanceStatus> query, int top, string continuationToken, CancellationToken cancellationToken)
async Task<DurableStatusQueryResult> QueryStateAsync(TableQuery<OrchestrationInstanceStatus> query, int top, string continuationToken, CancellationToken cancellationToken)
{
TableContinuationToken token = null;
var orchestrationStates = new List<OrchestrationState>(top);
Expand All @@ -566,7 +566,7 @@ private async Task<DurableStatusQueryResult> QueryStateAsync(TableQuery<Orchestr
};
}

private async Task<IList<OrchestrationState>> QueryStateAsync(TableQuery<OrchestrationInstanceStatus> query, CancellationToken cancellationToken)
async Task<IList<OrchestrationState>> QueryStateAsync(TableQuery<OrchestrationInstanceStatus> query, CancellationToken cancellationToken)
{
TableContinuationToken token = null;
var orchestrationStates = new List<OrchestrationState>(100);
Expand All @@ -593,7 +593,7 @@ private async Task<IList<OrchestrationState>> QueryStateAsync(TableQuery<Orchest
return orchestrationStates;
}

private async Task<PurgeHistoryResult> DeleteHistoryAsync(DateTime createdTimeFrom, DateTime? createdTimeTo, IEnumerable<OrchestrationStatus> runtimeStatus)
async Task<PurgeHistoryResult> DeleteHistoryAsync(DateTime createdTimeFrom, DateTime? createdTimeTo, IEnumerable<OrchestrationStatus> runtimeStatus)
{
TableQuery<OrchestrationInstanceStatus> query = OrchestrationInstanceStatusQueryCondition.Parse(createdTimeFrom, createdTimeTo, runtimeStatus)
.ToTableQuery<OrchestrationInstanceStatus>();
Expand Down Expand Up @@ -630,7 +630,7 @@ private async Task<PurgeHistoryResult> DeleteHistoryAsync(DateTime createdTimeFr
return new PurgeHistoryResult(storageRequests, instancesDeleted, rowsDeleted);
}

private async Task<PurgeHistoryResult> DeleteAllDataForOrchestrationInstance(OrchestrationInstanceStatus orchestrationInstanceStatus)
async Task<PurgeHistoryResult> DeleteAllDataForOrchestrationInstance(OrchestrationInstanceStatus orchestrationInstanceStatus)
{
int storageRequests = 0;
int rowsDeleted = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@

namespace DurableTask.AzureStorage.Tracking
{
using DurableTask.Core;
using Microsoft.WindowsAzure.Storage.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using DurableTask.Core;
using Microsoft.WindowsAzure.Storage.Table;

/// <summary>
/// OrchestrationInstanceStatusQueryBuilder is a builder to create a StorageTable Query
/// </summary>
internal class OrchestrationInstanceStatusQueryCondition
class OrchestrationInstanceStatusQueryCondition
{
public IEnumerable<OrchestrationStatus> RuntimeStatus { get; set; }

Expand All @@ -45,7 +43,7 @@ public TableQuery<T> ToTableQuery<T>()
return query;
}

private string GetConditions()
string GetConditions()
{
var conditions = new List<string>();

Expand All @@ -72,7 +70,6 @@ private string GetConditions()
return conditions.Count == 1 ?
conditions[0] :
conditions.Aggregate((a, b) => TableQuery.CombineFilters(a, TableOperators.And, b));

}

/// <summary>
Expand Down
34 changes: 0 additions & 34 deletions src/DurableTask.AzureStorage/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,4 @@ public static int GetEpisodeNumber(IEnumerable<HistoryEvent> historyEvents)
return historyEvents.Count(e => e.EventType == EventType.OrchestratorStarted);
}
}

/// <summary>
/// Class to hold statistics about this execution of purge history
/// </summary>
public class PurgeHistoryResult
{
/// <summary>
/// Constructor for purge history statistics
/// </summary>
/// <param name="storageRequests">Requests sent to storage</param>
/// <param name="instancesDeleted">Number of instances deleted</param>
/// <param name="rowsDeleted">Number of rows deleted</param>
public PurgeHistoryResult(int storageRequests, int instancesDeleted, int rowsDeleted)
{
this.StorageRequests = storageRequests;
this.InstancesDeleted = instancesDeleted;
this.RowsDeleted = rowsDeleted;
}

/// <summary>
/// Number of requests sent to Storage during this execution of purge history
/// </summary>
public int StorageRequests { get; }

/// <summary>
/// Number of instances deleted during this execution of purge history
/// </summary>
public int InstancesDeleted { get; }

/// <summary>
/// Number of rows deleted during this execution of purge history
/// </summary>
public int RowsDeleted { get; }
}
}

0 comments on commit 0d67574

Please sign in to comment.