[#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);
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using FrostFS.SDK.ClientV2;
|
||||
using Frostfs.V2.Ape;
|
||||
namespace FrostFS.SDK.ClientV2.Interfaces;
|
||||
|
||||
public interface IFrostFSClient : IDisposable
|
||||
|
@ -19,6 +19,14 @@ public interface IFrostFSClient : IDisposable
|
|||
Task<FrostFsSessionToken> CreateSessionAsync(PrmSessionCreate args);
|
||||
#endregion
|
||||
|
||||
#region ApeMAnager
|
||||
Task<byte[]> AddChainAsync(PrmApeChainAdd args);
|
||||
|
||||
Task RemoveChainAsync(PrmApeChainRemove args);
|
||||
|
||||
Task<Chain[]> ListChainAsync(PrmApeChainList args);
|
||||
#endregion
|
||||
|
||||
#region Container
|
||||
Task<FrostFsContainerInfo> GetContainerAsync(PrmContainerGet args);
|
||||
|
||||
|
|
37
src/FrostFS.SDK.ClientV2/Models/Chain/ChainTarget.cs
Normal file
37
src/FrostFS.SDK.ClientV2/Models/Chain/ChainTarget.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
|
||||
using Frostfs.V2.Ape;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2
|
||||
{
|
||||
public struct FrostFsChainTarget(FrostFsTargetType type, string name)
|
||||
{
|
||||
private ChainTarget? chainTarget;
|
||||
|
||||
public FrostFsTargetType Type { get; } = type;
|
||||
|
||||
public string Name { get; } = name;
|
||||
|
||||
internal ChainTarget GetChainTarget()
|
||||
{
|
||||
return chainTarget ??= new ChainTarget
|
||||
{
|
||||
Type = GetTargetType(Type),
|
||||
Name = Name
|
||||
};
|
||||
}
|
||||
|
||||
private static TargetType GetTargetType(FrostFsTargetType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
FrostFsTargetType.Undefined => TargetType.Undefined,
|
||||
FrostFsTargetType.Namespace => TargetType.Namespace,
|
||||
FrostFsTargetType.Container => TargetType.Container,
|
||||
FrostFsTargetType.User => TargetType.User,
|
||||
FrostFsTargetType.Group => TargetType.Group,
|
||||
_ => throw new ArgumentException("Unexpected value for TargetType", nameof(type)),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
16
src/FrostFS.SDK.ClientV2/Models/Chain/FrostFsChain.cs
Normal file
16
src/FrostFS.SDK.ClientV2/Models/Chain/FrostFsChain.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Google.Protobuf;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2
|
||||
{
|
||||
public struct FrostFsChain (byte[] raw)
|
||||
{
|
||||
private ByteString? grpcRaw;
|
||||
|
||||
public byte[] Raw { get; } = raw;
|
||||
|
||||
internal ByteString GetRaw()
|
||||
{
|
||||
return grpcRaw ??= ByteString.CopyFrom(Raw);
|
||||
}
|
||||
}
|
||||
}
|
11
src/FrostFS.SDK.ClientV2/Models/Chain/FrostFsTargetType.cs
Normal file
11
src/FrostFS.SDK.ClientV2/Models/Chain/FrostFsTargetType.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace FrostFS.SDK.ClientV2
|
||||
{
|
||||
public enum FrostFsTargetType
|
||||
{
|
||||
Undefined = 0,
|
||||
Namespace,
|
||||
Container,
|
||||
User,
|
||||
Group
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ namespace FrostFS.SDK;
|
|||
|
||||
public class FrostFsContainerInfo
|
||||
{
|
||||
private Container.Container.Types.Attribute[]? grpsAttributes;
|
||||
private FrostFS.Container.Container.Types.Attribute[]? grpsAttributes;
|
||||
private List<FrostFsAttribute>? attributes;
|
||||
private FrostFsPlacementPolicy? placementPolicy;
|
||||
private Guid? nonce;
|
||||
|
|
6
src/FrostFS.SDK.ClientV2/Parameters/PrmApeChainList.cs
Normal file
6
src/FrostFS.SDK.ClientV2/Parameters/PrmApeChainList.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
public sealed class PrmApeChainList(FrostFsChainTarget target) : PrmBase
|
||||
{
|
||||
public FrostFsChainTarget Target { get; } = target;
|
||||
}
|
8
src/FrostFS.SDK.ClientV2/Parameters/PrmApeChainRemove.cs
Normal file
8
src/FrostFS.SDK.ClientV2/Parameters/PrmApeChainRemove.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
public sealed class PrmApeChainRemove(FrostFsChainTarget target, FrostFsChain chain) : PrmBase
|
||||
{
|
||||
public FrostFsChainTarget Target { get; } = target;
|
||||
|
||||
public FrostFsChain Chain { get; } = chain;
|
||||
}
|
8
src/FrostFS.SDK.ClientV2/Parameters/PrmApeRemoveAdd.cs
Normal file
8
src/FrostFS.SDK.ClientV2/Parameters/PrmApeRemoveAdd.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
public sealed class PrmApeChainAdd(FrostFsChainTarget target, FrostFsChain chain) : PrmBase
|
||||
{
|
||||
public FrostFsChainTarget Target { get; } = target;
|
||||
|
||||
public FrostFsChain Chain { get; } = chain;
|
||||
}
|
|
@ -7,7 +7,6 @@ using FrostFS.SDK.ClientV2;
|
|||
using FrostFS.Container;
|
||||
using FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
using FrostFS.SDK.ClientV2;
|
||||
using FrostFS.Refs;
|
||||
using FrostFS.Session;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using FrostFS.Netmap;
|
||||
using FrostFS.SDK.ClientV2;
|
||||
|
||||
using static FrostFS.Netmap.NetworkConfig.Types;
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Frostfs.V2.Ape;
|
||||
using Frostfs.V2.Apemanager;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
internal class ApeManagerServiceProvider : ContextAccessor
|
||||
{
|
||||
private readonly APEManagerService.APEManagerServiceClient? _apeManagerServiceClient;
|
||||
|
||||
internal ApeManagerServiceProvider(APEManagerService.APEManagerServiceClient? apeManagerServiceClient, ClientEnvironment context)
|
||||
: base (context)
|
||||
{
|
||||
_apeManagerServiceClient = apeManagerServiceClient;
|
||||
}
|
||||
|
||||
internal async Task<byte[]> AddChainAsync(PrmApeChainAdd args)
|
||||
{
|
||||
var ctx = args.Context!;
|
||||
|
||||
AddChainRequest request = new()
|
||||
{
|
||||
Body = new()
|
||||
{
|
||||
Chain = new () { Raw = args.Chain.GetRaw() },
|
||||
Target = args.Target.GetChainTarget()
|
||||
}
|
||||
};
|
||||
|
||||
request.AddMetaHeader(args.XHeaders);
|
||||
request.Sign(ctx.Key);
|
||||
|
||||
var response = await _apeManagerServiceClient!.AddChainAsync(request, null, ctx.Deadline, ctx.CancellationToken);
|
||||
|
||||
Verifier.CheckResponse(response);
|
||||
|
||||
return response.Body.ChainId.ToByteArray();
|
||||
}
|
||||
|
||||
internal async Task RemoveChainAsync(PrmApeChainRemove args)
|
||||
{
|
||||
var ctx = args.Context!;
|
||||
RemoveChainRequest request = new()
|
||||
{
|
||||
Body = new()
|
||||
{
|
||||
ChainId = args.Chain.GetRaw(),
|
||||
Target = args.Target.GetChainTarget()
|
||||
}
|
||||
};
|
||||
|
||||
request.AddMetaHeader(args.XHeaders);
|
||||
request.Sign(ctx.Key);
|
||||
|
||||
var response = await _apeManagerServiceClient!.RemoveChainAsync(request, null, ctx.Deadline, ctx.CancellationToken);
|
||||
|
||||
Verifier.CheckResponse(response);
|
||||
}
|
||||
|
||||
internal async Task<Chain[]> ListChainAsync(PrmApeChainList args)
|
||||
{
|
||||
var ctx = args.Context!;
|
||||
ListChainsRequest request = new()
|
||||
{
|
||||
Body = new()
|
||||
{
|
||||
Target = args.Target.GetChainTarget()
|
||||
}
|
||||
};
|
||||
|
||||
request.AddMetaHeader(args.XHeaders);
|
||||
request.Sign(ctx.Key);
|
||||
|
||||
var response = await _apeManagerServiceClient!.ListChainsAsync(request, null, ctx.Deadline, ctx.CancellationToken);
|
||||
|
||||
Verifier.CheckResponse(response);
|
||||
|
||||
return [.. response.Body.Chains];
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using FrostFS.SDK.ClientV2;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
internal interface ISessionProvider
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="accounting\*.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="acl\*.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="ape\*.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="apemanager\*.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="container\*.proto" GrpcServices="Client" />
|
||||
<Protobuf Include="lock\*.proto" GrpcServices="Client" />
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
syntax = "proto3";
|
||||
syntax = "proto3";
|
||||
|
||||
package frostfs.v2.apemanager;
|
||||
package frostfs.v2.ape;
|
||||
|
||||
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc;apemanager";
|
||||
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc;ape";
|
||||
|
||||
// TargetType is a type target to which a rule chain is defined.
|
||||
enum TargetType {
|
174
src/FrostFS.SDK.ProtosV2/apemanager/Extension.Message.cs
Normal file
174
src/FrostFS.SDK.ProtosV2/apemanager/Extension.Message.cs
Normal file
|
@ -0,0 +1,174 @@
|
|||
using Google.Protobuf;
|
||||
|
||||
using FrostFS.Session;
|
||||
using FrostFS.SDK.ProtosV2.Interfaces;
|
||||
|
||||
namespace Frostfs.V2.Apemanager;
|
||||
|
||||
public partial class AddChainRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class AddChainResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class RemoveChainRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class RemoveChainResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ListChainsRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ListChainsResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||
|
||||
package frostfs.v2.apemanager;
|
||||
|
||||
import "apemanager/types.proto";
|
||||
import "ape/types.proto";
|
||||
import "session/types.proto";
|
||||
|
||||
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc;apemanager";
|
||||
|
@ -52,10 +52,10 @@ service APEManagerService {
|
|||
message AddChainRequest {
|
||||
message Body {
|
||||
// A target for which a rule chain is added.
|
||||
ChainTarget target = 1;
|
||||
frostfs.v2.ape.ChainTarget target = 1;
|
||||
|
||||
// The chain to set for the target.
|
||||
Chain chain = 2;
|
||||
frostfs.v2.ape.Chain chain = 2;
|
||||
}
|
||||
|
||||
// The request's body.
|
||||
|
@ -95,7 +95,7 @@ message AddChainResponse {
|
|||
message RemoveChainRequest {
|
||||
message Body {
|
||||
// Target for which a rule chain is removed.
|
||||
ChainTarget target = 1;
|
||||
frostfs.v2.ape.ChainTarget target = 1;
|
||||
|
||||
// Chain ID assigned for the rule chain.
|
||||
bytes chain_id = 2;
|
||||
|
@ -135,7 +135,7 @@ message RemoveChainResponse {
|
|||
message ListChainsRequest {
|
||||
message Body {
|
||||
// Target for which rule chains are listed.
|
||||
ChainTarget target = 1;
|
||||
frostfs.v2.ape.ChainTarget target = 1;
|
||||
}
|
||||
|
||||
// The request's body.
|
||||
|
@ -154,7 +154,7 @@ message ListChainsRequest {
|
|||
message ListChainsResponse {
|
||||
message Body {
|
||||
// The list of chains defined for the reqeusted target.
|
||||
repeated Chain chains = 1;
|
||||
repeated frostfs.v2.ape.Chain chains = 1;
|
||||
}
|
||||
|
||||
// The response's body.
|
||||
|
@ -168,4 +168,4 @@ message ListChainsResponse {
|
|||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,62 +5,6 @@ using FrostFS.SDK.ProtosV2.Interfaces;
|
|||
|
||||
namespace FrostFS.Container;
|
||||
|
||||
public partial class AnnounceUsedSpaceRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class AnnounceUsedSpaceResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GetRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
|
@ -284,115 +228,3 @@ public partial class ListResponse : IResponse
|
|||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SetExtendedACLRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SetExtendedACLResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GetExtendedACLRequest : IRequest
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (RequestMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (RequestVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GetExtendedACLResponse : IResponse
|
||||
{
|
||||
IMetaHeader IVerifiableMessage.GetMetaHeader()
|
||||
{
|
||||
return MetaHeader;
|
||||
}
|
||||
|
||||
IVerificationHeader IVerifiableMessage.GetVerificationHeader()
|
||||
{
|
||||
return VerifyHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetMetaHeader(IMetaHeader metaHeader)
|
||||
{
|
||||
MetaHeader = (ResponseMetaHeader)metaHeader;
|
||||
}
|
||||
|
||||
void IVerifiableMessage.SetVerificationHeader(IVerificationHeader verificationHeader)
|
||||
{
|
||||
VerifyHeader = (ResponseVerificationHeader)verificationHeader;
|
||||
}
|
||||
|
||||
public IMessage GetBody()
|
||||
{
|
||||
return Body;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ import "refs/types.proto";
|
|||
import "session/types.proto";
|
||||
|
||||
// `ContainerService` provides API to interact with `Container` smart contract
|
||||
// in NeoFS sidechain via other NeoFS nodes. All of those actions can be done
|
||||
// equivalently by directly issuing transactions and RPC calls to sidechain
|
||||
// in FrostFS sidechain via other FrostFS nodes. All of those actions can be
|
||||
// done equivalently by directly issuing transactions and RPC calls to sidechain
|
||||
// nodes.
|
||||
service ContainerService {
|
||||
// `Put` invokes `Container` smart contract's `Put` method and returns
|
||||
|
@ -25,7 +25,7 @@ service ContainerService {
|
|||
// request to save the container has been sent to the sidechain;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// container create access denied.
|
||||
// container create access denied.
|
||||
rpc Put(PutRequest) returns (PutResponse);
|
||||
|
||||
// `Delete` invokes `Container` smart contract's `Delete` method and returns
|
||||
|
@ -38,7 +38,7 @@ service ContainerService {
|
|||
// request to remove the container has been sent to the sidechain;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// container delete access denied.
|
||||
// container delete access denied.
|
||||
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
||||
|
||||
// Returns container structure from `Container` smart contract storage.
|
||||
|
@ -50,7 +50,7 @@ service ContainerService {
|
|||
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
|
||||
// requested container not found;
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// access to container is denied.
|
||||
// access to container is denied.
|
||||
rpc Get(GetRequest) returns (GetResponse);
|
||||
|
||||
// Returns all owner's containers from 'Container` smart contract' storage.
|
||||
|
@ -60,47 +60,11 @@ service ContainerService {
|
|||
// container list has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// container list access denied.
|
||||
// container list access denied.
|
||||
rpc List(ListRequest) returns (ListResponse);
|
||||
|
||||
// Invokes 'SetEACL' method of 'Container` smart contract and returns response
|
||||
// immediately. After one more block in sidechain, changes in an Extended ACL
|
||||
// are added into smart contract storage.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS): \
|
||||
// request to save container eACL has been sent to the sidechain;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// set container eACL access denied.
|
||||
rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse);
|
||||
|
||||
// Returns Extended ACL table and signature from `Container` smart contract
|
||||
// storage.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS): \
|
||||
// container eACL has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
|
||||
// container not found;
|
||||
// - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \
|
||||
// eACL table not found;
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// access to container eACL is denied.
|
||||
rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse);
|
||||
|
||||
// Announces the space values used by the container for P2P synchronization.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS): \
|
||||
// estimation of used space has been successfully announced;
|
||||
// - Common failures (SECTION_FAILURE_COMMON).
|
||||
rpc AnnounceUsedSpace(AnnounceUsedSpaceRequest)
|
||||
returns (AnnounceUsedSpaceResponse);
|
||||
}
|
||||
|
||||
// New NeoFS Container creation request
|
||||
// New FrostFS Container creation request
|
||||
message PutRequest {
|
||||
// Container creation request has container structure's signature as a
|
||||
// separate field. It's not stored in sidechain, just verified on container
|
||||
|
@ -108,7 +72,7 @@ message PutRequest {
|
|||
// the stable-marshalled container strucutre, hence there is no need for
|
||||
// additional signature checks.
|
||||
message Body {
|
||||
// Container structure to register in NeoFS
|
||||
// Container structure to register in FrostFS
|
||||
container.Container container = 1;
|
||||
|
||||
// Signature of a stable-marshalled container according to RFC-6979.
|
||||
|
@ -127,7 +91,7 @@ message PutRequest {
|
|||
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// New NeoFS Container creation response
|
||||
// New FrostFS Container creation response
|
||||
message PutResponse {
|
||||
// Container put response body contains information about the newly registered
|
||||
// container as seen by `Container` smart contract. `ContainerID` can be
|
||||
|
@ -156,7 +120,7 @@ message DeleteRequest {
|
|||
// the container owner's intent. The signature will be verified by `Container`
|
||||
// smart contract, so signing algorithm must be supported by NeoVM.
|
||||
message Body {
|
||||
// Identifier of the container to delete from NeoFS
|
||||
// Identifier of the container to delete from FrostFS
|
||||
neo.fs.v2.refs.ContainerID container_id = 1;
|
||||
|
||||
// `ContainerID` signed with the container owner's key according to
|
||||
|
@ -282,150 +246,3 @@ message ListResponse {
|
|||
// transmission.
|
||||
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Set Extended ACL
|
||||
message SetExtendedACLRequest {
|
||||
// Set Extended ACL request body does not have separate `ContainerID`
|
||||
// reference. It will be taken from `EACLTable.container_id` field.
|
||||
message Body {
|
||||
// Extended ACL table to set for the container
|
||||
neo.fs.v2.acl.EACLTable eacl = 1;
|
||||
|
||||
// Signature of stable-marshalled Extended ACL table according to RFC-6979.
|
||||
neo.fs.v2.refs.SignatureRFC6979 signature = 2;
|
||||
}
|
||||
// Body of set extended acl request message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries request meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.RequestMetaHeader meta_header = 2;
|
||||
|
||||
// Carries request verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Set Extended ACL
|
||||
message SetExtendedACLResponse {
|
||||
// `SetExtendedACLResponse` has an empty body because the operation is
|
||||
// asynchronous and the update should be reflected in `Container` smart
|
||||
// contract's storage after next block is issued in sidechain.
|
||||
message Body {}
|
||||
|
||||
// Body of set extended acl response message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries response meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.ResponseMetaHeader meta_header = 2;
|
||||
|
||||
// Carries response verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Get Extended ACL
|
||||
message GetExtendedACLRequest {
|
||||
// Get Extended ACL request body
|
||||
message Body {
|
||||
// Identifier of the container having Extended ACL
|
||||
neo.fs.v2.refs.ContainerID container_id = 1;
|
||||
}
|
||||
|
||||
// Body of get extended acl request message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries request meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.RequestMetaHeader meta_header = 2;
|
||||
|
||||
// Carries request verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Get Extended ACL
|
||||
message GetExtendedACLResponse {
|
||||
// Get Extended ACL Response body can be empty if the requested container does
|
||||
// not have Extended ACL Table attached or Extended ACL has not been allowed
|
||||
// at the time of container creation.
|
||||
message Body {
|
||||
// Extended ACL requested, if available
|
||||
neo.fs.v2.acl.EACLTable eacl = 1;
|
||||
|
||||
// Signature of stable-marshalled Extended ACL according to RFC-6979.
|
||||
neo.fs.v2.refs.SignatureRFC6979 signature = 2;
|
||||
|
||||
// Session token if Extended ACL was set within a session
|
||||
neo.fs.v2.session.SessionToken session_token = 3;
|
||||
}
|
||||
// Body of get extended acl response message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries response meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.ResponseMetaHeader meta_header = 2;
|
||||
|
||||
// Carries response verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Announce container used space
|
||||
message AnnounceUsedSpaceRequest {
|
||||
// Container used space announcement body.
|
||||
message Body {
|
||||
// Announcement contains used space information for a single container.
|
||||
message Announcement {
|
||||
// Epoch number for which the container size estimation was produced.
|
||||
uint64 epoch = 1;
|
||||
|
||||
// Identifier of the container.
|
||||
neo.fs.v2.refs.ContainerID container_id = 2;
|
||||
|
||||
// Used space is a sum of object payload sizes of a specified
|
||||
// container, stored in the node. It must not include inhumed objects.
|
||||
uint64 used_space = 3;
|
||||
}
|
||||
|
||||
// List of announcements. If nodes share several containers,
|
||||
// announcements are transferred in a batch.
|
||||
repeated Announcement announcements = 1;
|
||||
}
|
||||
|
||||
// Body of announce used space request message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries request meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.RequestMetaHeader meta_header = 2;
|
||||
|
||||
// Carries request verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
||||
// Announce container used space
|
||||
message AnnounceUsedSpaceResponse {
|
||||
// `AnnounceUsedSpaceResponse` has an empty body because announcements are
|
||||
// one way communication.
|
||||
message Body {}
|
||||
|
||||
// Body of announce used space response message.
|
||||
Body body = 1;
|
||||
|
||||
// Carries response meta information. Header data is used only to regulate
|
||||
// message transport and does not affect request execution.
|
||||
neo.fs.v2.session.ResponseMetaHeader meta_header = 2;
|
||||
|
||||
// Carries response verification information. This header is used to
|
||||
// authenticate the nodes of the message route and check the correctness of
|
||||
// transmission.
|
||||
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ message Container {
|
|||
// (`__NEOFS__DISABLE_HOMOMORPHIC_HASHING` is deprecated) \
|
||||
// Disables homomorphic hashing for the container if the value equals "true"
|
||||
// string. Any other values are interpreted as missing attribute. Container
|
||||
// could be accepted in a NeoFS network only if the global network hashing
|
||||
// could be accepted in a FrostFS network only if the global network hashing
|
||||
// configuration value corresponds with that attribute's value. After
|
||||
// container inclusion, network setting is ignored.
|
||||
//
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace FrostFS.SDK.SmokeTests;
|
|||
|
||||
public abstract class SmokeTestsBase
|
||||
{
|
||||
protected readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
||||
protected readonly string key = "KzPXA6669m2pf18XmUdoR8MnP1pi1PMmefiFujStVFnv7WR5SRmK";
|
||||
protected readonly string url = "http://172.23.32.4:8080";
|
||||
|
||||
protected ECDsa Key { get; }
|
||||
|
|
Loading…
Reference in a new issue