[#28] Client: Apply code optimizations
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
766f61a5f7
commit
749000a090
57 changed files with 845 additions and 1116 deletions
|
@ -4,12 +4,7 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Frostfs.V2.Ape;
|
||||
using Frostfs.V2.Apemanager;
|
||||
|
||||
using FrostFS.Accounting;
|
||||
using FrostFS.Container;
|
||||
using FrostFS.Netmap;
|
||||
using FrostFS.Object;
|
||||
using FrostFS.SDK.Client.Interfaces;
|
||||
using FrostFS.SDK.Client.Services;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
|
@ -21,32 +16,40 @@ using Grpc.Net.Client;
|
|||
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using static Frostfs.V2.Apemanager.APEManagerService;
|
||||
using static FrostFS.Accounting.AccountingService;
|
||||
using static FrostFS.Container.ContainerService;
|
||||
using static FrostFS.Netmap.NetmapService;
|
||||
using static FrostFS.Object.ObjectService;
|
||||
using static FrostFS.Session.SessionService;
|
||||
|
||||
namespace FrostFS.SDK.Client;
|
||||
|
||||
public class FrostFSClient : IFrostFSClient
|
||||
{
|
||||
private bool isDisposed;
|
||||
|
||||
internal ContainerService.ContainerServiceClient? ContainerServiceClient { get; set; }
|
||||
internal ContainerServiceClient? ContainerServiceClient { get; set; }
|
||||
internal ContainerServiceProvider? ContainerServiceProvider { get; set; }
|
||||
|
||||
internal NetmapService.NetmapServiceClient? NetmapServiceClient { get; set; }
|
||||
internal NetmapServiceClient? NetmapServiceClient { get; set; }
|
||||
internal NetmapServiceProvider? NetmapServiceProvider { get; set; }
|
||||
|
||||
internal APEManagerService.APEManagerServiceClient? ApeManagerServiceClient { get; set; }
|
||||
internal APEManagerServiceClient? ApeManagerServiceClient { get; set; }
|
||||
internal ApeManagerServiceProvider? ApeManagerServiceProvider { get; set; }
|
||||
|
||||
internal SessionService.SessionServiceClient? SessionServiceClient { get; set; }
|
||||
internal SessionServiceClient? SessionServiceClient { get; set; }
|
||||
internal SessionServiceProvider? SessionServiceProvider { get; set; }
|
||||
|
||||
internal ObjectService.ObjectServiceClient? ObjectServiceClient { get; set; }
|
||||
internal ObjectServiceClient? ObjectServiceClient { get; set; }
|
||||
internal ObjectServiceProvider? ObjectServiceProvider { get; set; }
|
||||
|
||||
internal AccountingService.AccountingServiceClient? AccountingServiceClient { get; set; }
|
||||
internal AccountingServiceClient? AccountingServiceClient { get; set; }
|
||||
internal AccountingServiceProvider? AccountingServiceProvider { get; set; }
|
||||
|
||||
internal ClientContext ClientCtx { get; set; }
|
||||
|
||||
public static IFrostFSClient GetInstance(IOptions<ClientSettings> clientOptions, GrpcChannelOptions? channelOptions = null)
|
||||
{
|
||||
return new FrostFSClient(clientOptions, channelOptions);
|
||||
}
|
||||
|
||||
public static IFrostFSClient GetSingleOwnerInstance(IOptions<SingleOwnerClientSettings> clientOptions, GrpcChannelOptions? channelOptions = null)
|
||||
public static IFrostFSClient GetSingleOwnerInstance(IOptions<ClientSettings> clientOptions, GrpcChannelOptions? channelOptions = null)
|
||||
{
|
||||
return new FrostFSClient(clientOptions, channelOptions);
|
||||
}
|
||||
|
@ -62,28 +65,28 @@ public class FrostFSClient : IFrostFSClient
|
|||
/// <param name="objectService">Object.ObjectService.ObjectServiceClient implementation</param>
|
||||
/// <returns></returns>
|
||||
public static IFrostFSClient GetTestInstance(
|
||||
IOptions<SingleOwnerClientSettings> clientOptions,
|
||||
IOptions<ClientSettings> settings,
|
||||
GrpcChannelOptions? channelOptions,
|
||||
NetmapService.NetmapServiceClient netmapService,
|
||||
SessionService.SessionServiceClient sessionService,
|
||||
ContainerService.ContainerServiceClient containerService,
|
||||
ObjectService.ObjectServiceClient objectService)
|
||||
NetmapServiceClient netmapService,
|
||||
SessionServiceClient sessionService,
|
||||
ContainerServiceClient containerService,
|
||||
ObjectServiceClient objectService)
|
||||
{
|
||||
if (clientOptions is null)
|
||||
if (settings is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(clientOptions));
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
return new FrostFSClient(clientOptions, channelOptions, containerService, netmapService, sessionService, objectService);
|
||||
return new FrostFSClient(settings, channelOptions, containerService, netmapService, sessionService, objectService);
|
||||
}
|
||||
|
||||
private FrostFSClient(
|
||||
IOptions<SingleOwnerClientSettings> settings,
|
||||
IOptions<ClientSettings> settings,
|
||||
GrpcChannelOptions? channelOptions,
|
||||
ContainerService.ContainerServiceClient containerService,
|
||||
NetmapService.NetmapServiceClient netmapService,
|
||||
SessionService.SessionServiceClient sessionService,
|
||||
ObjectService.ObjectServiceClient objectService)
|
||||
ContainerServiceClient containerService,
|
||||
NetmapServiceClient netmapService,
|
||||
SessionServiceClient sessionService,
|
||||
ObjectServiceClient objectService)
|
||||
{
|
||||
if (settings is null)
|
||||
{
|
||||
|
@ -91,14 +94,18 @@ public class FrostFSClient : IFrostFSClient
|
|||
}
|
||||
|
||||
var ecdsaKey = settings.Value.Key.LoadWif();
|
||||
FrostFsOwner.FromKey(ecdsaKey);
|
||||
|
||||
ClientCtx = new ClientContext(
|
||||
client: this,
|
||||
key: ecdsaKey,
|
||||
key: new ClientKey(ecdsaKey),
|
||||
owner: FrostFsOwner.FromKey(ecdsaKey),
|
||||
channel: InitGrpcChannel(settings.Value.Host, channelOptions),
|
||||
version: new FrostFsVersion(2, 13));
|
||||
version: new FrostFsVersion(2, 13))
|
||||
{
|
||||
SessionCache = new SessionCache(0),
|
||||
Callback = settings.Value.Callback,
|
||||
Interceptors = settings.Value.Interceptors
|
||||
};
|
||||
|
||||
ContainerServiceClient = containerService ?? throw new ArgumentNullException(nameof(containerService));
|
||||
NetmapServiceClient = netmapService ?? throw new ArgumentNullException(nameof(netmapService));
|
||||
|
@ -106,28 +113,9 @@ public class FrostFSClient : IFrostFSClient
|
|||
ObjectServiceClient = objectService ?? throw new ArgumentNullException(nameof(objectService));
|
||||
}
|
||||
|
||||
private FrostFSClient(IOptions<ClientSettings> options, GrpcChannelOptions? channelOptions)
|
||||
private FrostFSClient(IOptions<ClientSettings> settings, GrpcChannelOptions? channelOptions)
|
||||
{
|
||||
var clientSettings = (options?.Value) ?? throw new ArgumentNullException(nameof(options), "Options value must be initialized");
|
||||
|
||||
clientSettings.Validate();
|
||||
|
||||
var channel = InitGrpcChannel(clientSettings.Host, channelOptions);
|
||||
|
||||
ClientCtx = new ClientContext(
|
||||
this,
|
||||
key: null,
|
||||
owner: null,
|
||||
channel: channel,
|
||||
version: new FrostFsVersion(2, 13));
|
||||
|
||||
// TODO: define timeout logic
|
||||
// CheckFrostFsVersionSupport(new Context { Timeout = TimeSpan.FromSeconds(20) });
|
||||
}
|
||||
|
||||
private FrostFSClient(IOptions<SingleOwnerClientSettings> options, GrpcChannelOptions? channelOptions)
|
||||
{
|
||||
var clientSettings = (options?.Value) ?? throw new ArgumentNullException(nameof(options), "Options value must be initialized");
|
||||
var clientSettings = (settings?.Value) ?? throw new ArgumentNullException(nameof(settings), "Options value must be initialized");
|
||||
|
||||
clientSettings.Validate();
|
||||
|
||||
|
@ -137,10 +125,15 @@ public class FrostFSClient : IFrostFSClient
|
|||
|
||||
ClientCtx = new ClientContext(
|
||||
this,
|
||||
key: ecdsaKey,
|
||||
key: new ClientKey(ecdsaKey),
|
||||
owner: FrostFsOwner.FromKey(ecdsaKey),
|
||||
channel: channel,
|
||||
version: new FrostFsVersion(2, 13));
|
||||
version: new FrostFsVersion(2, 13))
|
||||
{
|
||||
SessionCache = new SessionCache(0),
|
||||
Callback = settings.Value.Callback,
|
||||
Interceptors = settings.Value.Interceptors
|
||||
};
|
||||
|
||||
// TODO: define timeout logic
|
||||
// CheckFrostFsVersionSupport(new Context { Timeout = TimeSpan.FromSeconds(20) });
|
||||
|
@ -150,12 +143,14 @@ public class FrostFSClient : IFrostFSClient
|
|||
{
|
||||
ClientCtx = new ClientContext(
|
||||
client: this,
|
||||
key: prm.Key,
|
||||
key: new ClientKey(prm.Key),
|
||||
owner: FrostFsOwner.FromKey(prm.Key!),
|
||||
channel: InitGrpcChannel(prm.Address, null), //prm.GrpcChannelOptions),
|
||||
version: new FrostFsVersion(2, 13))
|
||||
{
|
||||
SessionCache = cache
|
||||
SessionCache = cache,
|
||||
Interceptors = prm.Interceptors,
|
||||
Callback = prm.Callback
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -175,14 +170,14 @@ public class FrostFSClient : IFrostFSClient
|
|||
}
|
||||
|
||||
#region ApeManagerImplementation
|
||||
public Task<byte[]> AddChainAsync(PrmApeChainAdd args)
|
||||
public Task<ReadOnlyMemory<byte>> AddChainAsync(PrmApeChainAdd args)
|
||||
{
|
||||
if (args is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
|
||||
var service = GetApeManagerService(args);
|
||||
var service = GetApeManagerService();
|
||||
return service.AddChainAsync(args);
|
||||
}
|
||||
|
||||
|
@ -193,7 +188,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
|
||||
var service = GetApeManagerService(args);
|
||||
var service = GetApeManagerService();
|
||||
return service.RemoveChainAsync(args);
|
||||
}
|
||||
|
||||
|
@ -202,7 +197,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetApeManagerService(args);
|
||||
var service = GetApeManagerService();
|
||||
return service.ListChainAsync(args);
|
||||
}
|
||||
#endregion
|
||||
|
@ -213,14 +208,14 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetContainerService(args);
|
||||
var service = GetContainerService();
|
||||
return service.GetContainerAsync(args);
|
||||
}
|
||||
|
||||
public IAsyncEnumerable<FrostFsContainerId> ListContainersAsync(PrmContainerGetAll? args = null)
|
||||
{
|
||||
args ??= new PrmContainerGetAll();
|
||||
var service = GetContainerService(args);
|
||||
var service = GetContainerService();
|
||||
return service.ListContainersAsync(args);
|
||||
}
|
||||
|
||||
|
@ -229,7 +224,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetContainerService(args);
|
||||
var service = GetContainerService();
|
||||
return service.CreateContainerAsync(args);
|
||||
}
|
||||
|
||||
|
@ -238,7 +233,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetContainerService(args);
|
||||
var service = GetContainerService();
|
||||
return service.DeleteContainerAsync(args);
|
||||
}
|
||||
#endregion
|
||||
|
@ -247,21 +242,21 @@ public class FrostFSClient : IFrostFSClient
|
|||
public Task<FrostFsNetmapSnapshot> GetNetmapSnapshotAsync(PrmNetmapSnapshot? args)
|
||||
{
|
||||
args ??= new PrmNetmapSnapshot();
|
||||
var service = GetNetmapService(args);
|
||||
var service = GetNetmapService();
|
||||
return service.GetNetmapSnapshotAsync(args);
|
||||
}
|
||||
|
||||
public Task<FrostFsNodeInfo> GetNodeInfoAsync(PrmNodeInfo? args)
|
||||
{
|
||||
args ??= new PrmNodeInfo();
|
||||
var service = GetNetmapService(args);
|
||||
var service = GetNetmapService();
|
||||
return service.GetLocalNodeInfoAsync(args);
|
||||
}
|
||||
|
||||
public Task<NetworkSettings> GetNetworkSettingsAsync(PrmNetworkSettings? args)
|
||||
{
|
||||
args ??= new PrmNetworkSettings();
|
||||
var service = GetNetmapService(args);
|
||||
var service = GetNetmapService();
|
||||
return service.GetNetworkSettingsAsync(args.Context!);
|
||||
}
|
||||
#endregion
|
||||
|
@ -272,7 +267,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.GetObjectHeadAsync(args);
|
||||
}
|
||||
|
||||
|
@ -281,7 +276,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.GetObjectAsync(args);
|
||||
}
|
||||
|
||||
|
@ -290,7 +285,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.GetRangeAsync(args);
|
||||
}
|
||||
|
||||
|
@ -299,17 +294,16 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.GetRangeHashAsync(args);
|
||||
}
|
||||
|
||||
|
||||
public Task<FrostFsObjectId> PutObjectAsync(PrmObjectPut args)
|
||||
{
|
||||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.PutObjectAsync(args);
|
||||
}
|
||||
|
||||
|
@ -318,7 +312,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.PutSingleObjectAsync(args);
|
||||
}
|
||||
|
||||
|
@ -329,7 +323,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.PatchObjectAsync(args);
|
||||
}
|
||||
|
||||
|
@ -338,7 +332,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.DeleteObjectAsync(args);
|
||||
}
|
||||
|
||||
|
@ -347,7 +341,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetObjectService(args);
|
||||
var service = GetObjectService();
|
||||
return service.SearchObjectsAsync(args);
|
||||
}
|
||||
#endregion
|
||||
|
@ -358,10 +352,9 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var session = await CreateSessionInternalAsync(args).ConfigureAwait(false);
|
||||
var token = await CreateSessionInternalAsync(args).ConfigureAwait(false);
|
||||
|
||||
var token = session.Serialize();
|
||||
return new FrostFsSessionToken(token, session.Body.Id.ToUuid());
|
||||
return new FrostFsSessionToken(token);
|
||||
}
|
||||
|
||||
internal Task<SessionToken> CreateSessionInternalAsync(PrmSessionCreate args)
|
||||
|
@ -369,7 +362,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
if (args is null)
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
|
||||
var service = GetSessionService(args);
|
||||
var service = GetSessionService();
|
||||
return service.CreateSessionAsync(args);
|
||||
}
|
||||
#endregion
|
||||
|
@ -379,18 +372,18 @@ public class FrostFSClient : IFrostFSClient
|
|||
{
|
||||
args ??= new PrmBalance();
|
||||
|
||||
var service = GetAccouningService(args);
|
||||
var service = GetAccouningService();
|
||||
return await service.GetBallance(args).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ToolsImplementation
|
||||
public FrostFsObjectId CalculateObjectId(FrostFsObjectHeader header, CallContext ctx)
|
||||
public FrostFsObjectId CalculateObjectId(FrostFsObjectHeader header)
|
||||
{
|
||||
if (header == null)
|
||||
throw new ArgumentNullException(nameof(header));
|
||||
|
||||
return ObjectTools.CalculateObjectId(header, ctx);
|
||||
return ObjectTools.CalculateObjectId(header, this.ClientCtx);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -398,59 +391,34 @@ public class FrostFSClient : IFrostFSClient
|
|||
{
|
||||
var args = new PrmNodeInfo(ctx);
|
||||
|
||||
if (ctx?.Version == null)
|
||||
throw new ArgumentNullException(nameof(ctx), "Version must be initialized");
|
||||
|
||||
var service = GetNetmapService(args);
|
||||
var service = GetNetmapService();
|
||||
var localNodeInfo = await service.GetLocalNodeInfoAsync(args).ConfigureAwait(false);
|
||||
|
||||
if (!localNodeInfo.Version.IsSupported(ctx.Version))
|
||||
if (!localNodeInfo.Version.IsSupported(ClientCtx.Version))
|
||||
{
|
||||
var msg = $"FrostFS {localNodeInfo.Version} is not supported.";
|
||||
throw new FrostFsException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private CallInvoker? SetupClientContext(IContext ctx)
|
||||
private CallInvoker? CreateInvoker()
|
||||
{
|
||||
if (isDisposed)
|
||||
throw new FrostFsInvalidObjectException("Client is disposed.");
|
||||
|
||||
if (ctx.Context!.Key == null)
|
||||
{
|
||||
if (ClientCtx.Key == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(ctx), "Key is not initialized.");
|
||||
}
|
||||
|
||||
ctx.Context.Key = ClientCtx.Key.ECDsaKey;
|
||||
}
|
||||
|
||||
if (ctx.Context.OwnerId == null)
|
||||
{
|
||||
ctx.Context.OwnerId = ClientCtx.Owner ?? FrostFsOwner.FromKey(ctx.Context.Key);
|
||||
}
|
||||
|
||||
if (ctx.Context.Version == null)
|
||||
{
|
||||
if (ClientCtx.Version == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(ctx), "Version is not initialized.");
|
||||
}
|
||||
|
||||
ctx.Context.Version = ClientCtx.Version;
|
||||
}
|
||||
|
||||
CallInvoker? callInvoker = null;
|
||||
|
||||
foreach (var interceptor in ctx.Context.Interceptors)
|
||||
callInvoker = AddInvoker(callInvoker, interceptor);
|
||||
if (ClientCtx.Interceptors != null)
|
||||
{
|
||||
foreach (var interceptor in ClientCtx.Interceptors)
|
||||
callInvoker = AddInvoker(callInvoker, interceptor);
|
||||
}
|
||||
|
||||
if (ctx.Context.Callback != null)
|
||||
callInvoker = AddInvoker(callInvoker, new MetricsInterceptor(ctx.Context.Callback));
|
||||
if (ClientCtx.Callback != null)
|
||||
callInvoker = AddInvoker(callInvoker, new MetricsInterceptor(ClientCtx.Callback));
|
||||
|
||||
if (ctx.Context.PoolErrorHandler != null)
|
||||
callInvoker = AddInvoker(callInvoker, new ErrorInterceptor(ctx.Context.PoolErrorHandler));
|
||||
if (ClientCtx.PoolErrorHandler != null)
|
||||
callInvoker = AddInvoker(callInvoker, new ErrorInterceptor(ClientCtx.PoolErrorHandler));
|
||||
|
||||
return callInvoker;
|
||||
|
||||
|
@ -465,75 +433,109 @@ public class FrostFSClient : IFrostFSClient
|
|||
}
|
||||
}
|
||||
|
||||
private NetmapServiceProvider GetNetmapService(IContext ctx)
|
||||
private NetmapServiceProvider GetNetmapService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = NetmapServiceClient ?? (callInvoker != null
|
||||
? new NetmapService.NetmapServiceClient(callInvoker)
|
||||
: new NetmapService.NetmapServiceClient(ClientCtx.Channel));
|
||||
if (NetmapServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
return new NetmapServiceProvider(client, ClientCtx);
|
||||
NetmapServiceClient = NetmapServiceClient ?? (
|
||||
invoker != null
|
||||
? new NetmapServiceClient(invoker)
|
||||
: new NetmapServiceClient(ClientCtx.Channel));
|
||||
|
||||
NetmapServiceProvider = new NetmapServiceProvider(NetmapServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return NetmapServiceProvider;
|
||||
}
|
||||
|
||||
private SessionServiceProvider GetSessionService(IContext ctx)
|
||||
private SessionServiceProvider GetSessionService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = SessionServiceClient ?? (callInvoker != null
|
||||
? new SessionService.SessionServiceClient(callInvoker)
|
||||
: new SessionService.SessionServiceClient(ClientCtx.Channel));
|
||||
if (SessionServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
SessionServiceClient = SessionServiceClient ?? (
|
||||
invoker != null
|
||||
? new SessionServiceClient(invoker)
|
||||
: new SessionServiceClient(ClientCtx.Channel));
|
||||
|
||||
SessionServiceProvider = new SessionServiceProvider(SessionServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return SessionServiceProvider;
|
||||
|
||||
return new SessionServiceProvider(client, ClientCtx);
|
||||
}
|
||||
|
||||
private ApeManagerServiceProvider GetApeManagerService(IContext ctx)
|
||||
private ApeManagerServiceProvider GetApeManagerService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = ApeManagerServiceClient ?? (callInvoker != null
|
||||
? new APEManagerService.APEManagerServiceClient(callInvoker)
|
||||
: new APEManagerService.APEManagerServiceClient(ClientCtx.Channel));
|
||||
if (ApeManagerServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
return new ApeManagerServiceProvider(client, ClientCtx);
|
||||
ApeManagerServiceClient = ApeManagerServiceClient ?? (
|
||||
invoker != null
|
||||
? new APEManagerServiceClient(invoker)
|
||||
: new APEManagerServiceClient(ClientCtx.Channel));
|
||||
|
||||
ApeManagerServiceProvider = new ApeManagerServiceProvider(ApeManagerServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return ApeManagerServiceProvider;
|
||||
}
|
||||
|
||||
private AccountingServiceProvider GetAccouningService(IContext ctx)
|
||||
private AccountingServiceProvider GetAccouningService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = AccountingServiceClient ?? (callInvoker != null
|
||||
? new AccountingService.AccountingServiceClient(callInvoker)
|
||||
: new AccountingService.AccountingServiceClient(ClientCtx.Channel));
|
||||
if (this.AccountingServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
return new AccountingServiceProvider(client, ClientCtx);
|
||||
AccountingServiceClient = AccountingServiceClient ?? (
|
||||
invoker != null
|
||||
? new AccountingServiceClient(invoker)
|
||||
: new AccountingServiceClient(ClientCtx.Channel));
|
||||
|
||||
AccountingServiceProvider = new AccountingServiceProvider(AccountingServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return AccountingServiceProvider;
|
||||
}
|
||||
|
||||
private ContainerServiceProvider GetContainerService(IContext ctx)
|
||||
private ContainerServiceProvider GetContainerService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = ContainerServiceClient ?? (callInvoker != null
|
||||
? new ContainerService.ContainerServiceClient(callInvoker)
|
||||
: new ContainerService.ContainerServiceClient(ClientCtx.Channel));
|
||||
if (this.ContainerServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
return new ContainerServiceProvider(client, ClientCtx);
|
||||
ContainerServiceClient = ContainerServiceClient ?? (
|
||||
invoker != null
|
||||
? new ContainerServiceClient(invoker)
|
||||
: new ContainerServiceClient(ClientCtx.Channel));
|
||||
|
||||
ContainerServiceProvider = new ContainerServiceProvider(ContainerServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return ContainerServiceProvider;
|
||||
}
|
||||
|
||||
private ObjectServiceProvider GetObjectService(IContext ctx)
|
||||
private ObjectServiceProvider GetObjectService()
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = ObjectServiceClient ?? (callInvoker != null
|
||||
? new ObjectService.ObjectServiceClient(callInvoker)
|
||||
: new ObjectService.ObjectServiceClient(ClientCtx.Channel));
|
||||
if (this.ObjectServiceProvider == null)
|
||||
{
|
||||
var invoker = CreateInvoker();
|
||||
|
||||
return new ObjectServiceProvider(client, ClientCtx);
|
||||
ObjectServiceClient = ObjectServiceClient ?? (
|
||||
invoker != null
|
||||
? new ObjectServiceClient(invoker)
|
||||
: new ObjectServiceClient(ClientCtx.Channel));
|
||||
|
||||
ObjectServiceProvider = new ObjectServiceProvider(ObjectServiceClient, ClientCtx);
|
||||
}
|
||||
|
||||
return ObjectServiceProvider;
|
||||
}
|
||||
|
||||
private AccountingServiceProvider GetAccountService(IContext ctx)
|
||||
{
|
||||
var callInvoker = SetupClientContext(ctx);
|
||||
var client = AccountingServiceClient ?? (callInvoker != null
|
||||
? new AccountingService.AccountingServiceClient(callInvoker)
|
||||
: new AccountingService.AccountingServiceClient(ClientCtx.Channel));
|
||||
|
||||
return new AccountingServiceProvider(client, ClientCtx);
|
||||
}
|
||||
|
||||
private static GrpcChannel InitGrpcChannel(string host, GrpcChannelOptions? channelOptions)
|
||||
{
|
||||
|
@ -559,7 +561,7 @@ public class FrostFSClient : IFrostFSClient
|
|||
{
|
||||
var prm = new PrmBalance(ctx);
|
||||
|
||||
var service = GetAccouningService(prm);
|
||||
var service = GetAccouningService();
|
||||
_ = await service.GetBallance(prm).ConfigureAwait(false);
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue