[#24] Client: Add Ape manager
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
704ce41173
commit
d7dbbf8da8
21 changed files with 411 additions and 381 deletions
|
@ -7,7 +7,6 @@ using FrostFS.Container;
|
|||
using FrostFS.Netmap;
|
||||
using FrostFS.Object;
|
||||
using FrostFS.SDK.ClientV2.Interfaces;
|
||||
using FrostFS.SDK.ClientV2;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
using FrostFS.Session;
|
||||
|
||||
|
@ -16,6 +15,8 @@ using Grpc.Core.Interceptors;
|
|||
using Grpc.Net.Client;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
using Frostfs.V2.Apemanager;
|
||||
using Frostfs.V2.Ape;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
|
@ -24,8 +25,13 @@ public class Client : IFrostFSClient
|
|||
private bool isDisposed;
|
||||
|
||||
internal ContainerService.ContainerServiceClient? ContainerServiceClient { get; set; }
|
||||
|
||||
internal NetmapService.NetmapServiceClient? NetmapServiceClient { get; set; }
|
||||
|
||||
internal APEManagerService.APEManagerServiceClient? ApeManagerServiceClient { get; set; }
|
||||
|
||||
internal SessionService.SessionServiceClient? SessionServiceClient { get; set; }
|
||||
|
||||
internal ObjectService.ObjectServiceClient? ObjectServiceClient { get; set; }
|
||||
|
||||
internal ClientEnvironment ClientCtx { get; set; }
|
||||
|
@ -140,6 +146,26 @@ public class Client : IFrostFSClient
|
|||
}
|
||||
}
|
||||
|
||||
#region ApeManagerImplementation
|
||||
public Task<byte[]> AddChainAsync(PrmApeChainAdd args)
|
||||
{
|
||||
var service = GetApeManagerService(args);
|
||||
return service.AddChainAsync(args);
|
||||
}
|
||||
|
||||
public Task RemoveChainAsync(PrmApeChainRemove args)
|
||||
{
|
||||
var service = GetApeManagerService(args);
|
||||
return service.RemoveChainAsync(args);
|
||||
}
|
||||
|
||||
public Task<Chain[]> ListChainAsync(PrmApeChainList args)
|
||||
{
|
||||
var service = GetApeManagerService(args);
|
||||
return service.ListChainAsync(args);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ContainerImplementation
|
||||
public Task<FrostFsContainerInfo> GetContainerAsync(PrmContainerGet args)
|
||||
{
|
||||
|
@ -344,6 +370,16 @@ public class Client : IFrostFSClient
|
|||
return new SessionServiceProvider(client, ClientCtx);
|
||||
}
|
||||
|
||||
private ApeManagerServiceProvider GetApeManagerService(IContext ctx)
|
||||
{
|
||||
var callInvoker = SetupEnvironment(ctx);
|
||||
var client = ApeManagerServiceClient ?? (callInvoker != null
|
||||
? new APEManagerService.APEManagerServiceClient(callInvoker)
|
||||
: new APEManagerService.APEManagerServiceClient(ClientCtx.Channel));
|
||||
|
||||
return new ApeManagerServiceProvider(client, ClientCtx);
|
||||
}
|
||||
|
||||
private ContainerServiceProvider GetContainerService(IContext ctx)
|
||||
{
|
||||
var callInvoker = SetupEnvironment(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue