InstanceSettingsLegacyKeplerRetriever
using Relativity.Transfer.Dto;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Relativity.Transfer
{
internal class InstanceSettingsLegacyKeplerRetriever : IInstanceSettingRetriever
{
private readonly double timeoutSeconds;
private readonly int maxRetryAttempts;
private readonly RelativityConnectionInfo connectionInfo;
private readonly ITransferLog transferLog;
public InstanceSettingsLegacyKeplerRetriever(RelativityConnectionInfo connectionInfo, ITransferLog transferLog)
: this(connectionInfo, transferLog, 5, 300)
{
}
public InstanceSettingsLegacyKeplerRetriever(RelativityConnectionInfo connectionInfo, ITransferLog transferLog, int maxRetryAttempts, double timeoutSeconds)
{
this.maxRetryAttempts = maxRetryAttempts;
this.timeoutSeconds = timeoutSeconds;
this.transferLog = transferLog;
this.connectionInfo = connectionInfo;
}
[AsyncStateMachine(typeof(<GetAllAsync>d__6))]
public Task<IEnumerable<InstanceSetting>> GetAllAsync(CancellationToken token)
{
<GetAllAsync>d__6 stateMachine = default(<GetAllAsync>d__6);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<IEnumerable<InstanceSetting>>.Create();
stateMachine.<>4__this = this;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
[AsyncStateMachine(typeof(<GetSingleAsync>d__7))]
public Task<InstanceSetting> GetSingleAsync(string section, string name, CancellationToken token)
{
<GetSingleAsync>d__7 stateMachine = default(<GetSingleAsync>d__7);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<InstanceSetting>.Create();
stateMachine.<>4__this = this;
stateMachine.section = section;
stateMachine.name = name;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
[AsyncStateMachine(typeof(<GetInstanceSettingsAsync>d__8))]
private Task<IEnumerable<InstanceSetting>> GetInstanceSettingsAsync(string condition, CancellationToken token)
{
<GetInstanceSettingsAsync>d__8 stateMachine = default(<GetInstanceSettingsAsync>d__8);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<IEnumerable<InstanceSetting>>.Create();
stateMachine.<>4__this = this;
stateMachine.condition = condition;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
private static InstanceSetting CreateInstanceSetting(InstanceSettingDto dto)
{
return new InstanceSetting {
ArtifactId = dto.ArtifactId,
Name = dto.Name,
Description = dto.Description,
InitialValue = dto.InitialValue,
Machine = dto.Machine,
Section = dto.Section,
Value = dto.Value
};
}
}
}