InstanceSettingsConfigurationService
using Relativity.Transfer.InstanceSettings.Configuration;
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Relativity.Transfer.InstanceSettings
{
internal class InstanceSettingsConfigurationService : IInstanceSettingsConfigurationService
{
private class ConfigurationRetrieverResult
{
public InstanceSettingsConfiguration Configuration { get; set; }
public Exception Exception { get; set; }
public bool IsSuccess => Configuration != null;
}
private readonly IToggle useWebAbiToggle;
private readonly IInstanceSettingsConfigurationRetriever webApiConfigurationRetriever;
private readonly IInstanceSettingsConfigurationRetriever keplerConfigurationRetriever;
private readonly ITransferLog transferLog;
public InstanceSettingsConfigurationService(ITransferLog transferLog, IToggle useWebAbiToggle, IInstanceSettingsConfigurationRetriever webApiConfigurationRetriever, IInstanceSettingsConfigurationRetriever keplerConfigurationRetriever)
{
this.transferLog = transferLog;
this.useWebAbiToggle = useWebAbiToggle;
this.webApiConfigurationRetriever = webApiConfigurationRetriever;
this.keplerConfigurationRetriever = keplerConfigurationRetriever;
}
[AsyncStateMachine(typeof(<GetMaxAllowedTargetDataRateMbpsAsync>d__5))]
public Task<uint?> GetMaxAllowedTargetDataRateMbpsAsync(CancellationToken token)
{
<GetMaxAllowedTargetDataRateMbpsAsync>d__5 stateMachine = default(<GetMaxAllowedTargetDataRateMbpsAsync>d__5);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<uint?>.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(<GetIsCloudInstanceAsync>d__6))]
public Task<bool> GetIsCloudInstanceAsync(CancellationToken token)
{
<GetIsCloudInstanceAsync>d__6 stateMachine = default(<GetIsCloudInstanceAsync>d__6);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<bool>.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(<GetConfigurationAsync>d__7))]
private Task<InstanceSettingsConfiguration> GetConfigurationAsync(CancellationToken token)
{
<GetConfigurationAsync>d__7 stateMachine = default(<GetConfigurationAsync>d__7);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<InstanceSettingsConfiguration>.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(<GetConfigurationViaWebApiAsync>d__8))]
private Task<InstanceSettingsConfiguration> GetConfigurationViaWebApiAsync(CancellationToken token)
{
<GetConfigurationViaWebApiAsync>d__8 stateMachine = default(<GetConfigurationViaWebApiAsync>d__8);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<InstanceSettingsConfiguration>.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(<GetConfigurationViaKeplerAsync>d__9))]
private Task<ConfigurationRetrieverResult> GetConfigurationViaKeplerAsync(CancellationToken token)
{
<GetConfigurationViaKeplerAsync>d__9 stateMachine = default(<GetConfigurationViaKeplerAsync>d__9);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<ConfigurationRetrieverResult>.Create();
stateMachine.<>4__this = this;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}