[#18] Client: Rename parameters #19
31 changed files with 200 additions and 142 deletions
|
@ -117,26 +117,26 @@ public class Client : IFrostFSClient
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ContainerImplementation
|
#region ContainerImplementation
|
||||||
public Task<ModelsV2.Container> GetContainerAsync(PrmGetContainer args)
|
public Task<ModelsV2.Container> GetContainerAsync(PrmContainerGet args)
|
||||||
{
|
{
|
||||||
var service = GetContainerService(args);
|
var service = GetContainerService(args);
|
||||||
return service.GetContainerAsync(args);
|
return service.GetContainerAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAsyncEnumerable<ContainerId> ListContainersAsync(PrmListContainer? args = null)
|
public IAsyncEnumerable<ContainerId> ListContainersAsync(PrmContainerGetAll? args = null)
|
||||||
{
|
{
|
||||||
args = args ?? new PrmListContainer();
|
args = args ?? new PrmContainerGetAll();
|
||||||
var service = GetContainerService(args);
|
var service = GetContainerService(args);
|
||||||
return service.ListContainersAsync(args);
|
return service.ListContainersAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ContainerId> CreateContainerAsync(PrmCreateContainer args)
|
public Task<ContainerId> CreateContainerAsync(PrmContainerCreate args)
|
||||||
{
|
{
|
||||||
var service = GetContainerService(args);
|
var service = GetContainerService(args);
|
||||||
return service.CreateContainerAsync(args);
|
return service.CreateContainerAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteContainerAsync(PrmDeleteContainer args)
|
public Task DeleteContainerAsync(PrmContainerDelete args)
|
||||||
{
|
{
|
||||||
var service = GetContainerService(args);
|
var service = GetContainerService(args);
|
||||||
return service.DeleteContainerAsync(args);
|
return service.DeleteContainerAsync(args);
|
||||||
|
@ -144,60 +144,60 @@ public class Client : IFrostFSClient
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region NetworkImplementation
|
#region NetworkImplementation
|
||||||
public Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmGetNetmapSnapshot? args)
|
public Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmNetmapSnapshot? args)
|
||||||
{
|
{
|
||||||
args ??= new PrmGetNetmapSnapshot();
|
args ??= new PrmNetmapSnapshot();
|
||||||
var service = GetNetmapService(args);
|
var service = GetNetmapService(args);
|
||||||
return service.GetNetmapSnapshotAsync(args);
|
return service.GetNetmapSnapshotAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ModelsV2.Netmap.NodeInfo> GetNodeInfoAsync(PrmGetNodeInfo? args)
|
public Task<ModelsV2.Netmap.NodeInfo> GetNodeInfoAsync(PrmNodeInfo? args)
|
||||||
{
|
{
|
||||||
args ??= new PrmGetNodeInfo();
|
args ??= new PrmNodeInfo();
|
||||||
var service = GetNetmapService(args);
|
var service = GetNetmapService(args);
|
||||||
return service.GetLocalNodeInfoAsync(args);
|
return service.GetLocalNodeInfoAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<NetworkSettings> GetNetworkSettingsAsync(PrmGetNetworkSettings? args)
|
public Task<NetworkSettings> GetNetworkSettingsAsync(PrmNetworkSettings? args)
|
||||||
{
|
{
|
||||||
args ??= new PrmGetNetworkSettings();
|
args ??= new PrmNetworkSettings();
|
||||||
var service = GetNetmapService(args);
|
var service = GetNetmapService(args);
|
||||||
return service.GetNetworkSettingsAsync(args.Context!);
|
return service.GetNetworkSettingsAsync(args.Context!);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ObjectImplementation
|
#region ObjectImplementation
|
||||||
public Task<ObjectHeader> GetObjectHeadAsync(PrmGetObjectHead args)
|
public Task<ObjectHeader> GetObjectHeadAsync(PrmObjectHeadGet args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.GetObjectHeadAsync(args);
|
return service.GetObjectHeadAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<FrostFsObject> GetObjectAsync(PrmGetObject args)
|
public Task<FrostFsObject> GetObjectAsync(PrmObjectGet args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.GetObjectAsync(args);
|
return service.GetObjectAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ObjectId> PutObjectAsync(PrmPutObject args)
|
public Task<ObjectId> PutObjectAsync(PrmObjectPut args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.PutObjectAsync(args);
|
return service.PutObjectAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ObjectId> PutSingleObjectAsync(PrmPutSingleObject args)
|
public Task<ObjectId> PutSingleObjectAsync(PrmSingleObjectPut args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.PutSingleObjectAsync(args);
|
return service.PutSingleObjectAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteObjectAsync(PrmDeleteObject args)
|
public Task DeleteObjectAsync(PrmObjectDelete args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.DeleteObjectAsync(args);
|
return service.DeleteObjectAsync(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmSearchObject args)
|
public IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmObjectSearch args)
|
||||||
{
|
{
|
||||||
var service = GetObjectService(args);
|
var service = GetObjectService(args);
|
||||||
return service.SearchObjectsAsync(args);
|
return service.SearchObjectsAsync(args);
|
||||||
|
@ -205,7 +205,7 @@ public class Client : IFrostFSClient
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region SessionImplementation
|
#region SessionImplementation
|
||||||
public async Task<ModelsV2.SessionToken> CreateSessionAsync(PrmCreateSession args)
|
public async Task<ModelsV2.SessionToken> CreateSessionAsync(PrmSessionCreate args)
|
||||||
{
|
{
|
||||||
var session = await CreateSessionInternalAsync(args);
|
var session = await CreateSessionInternalAsync(args);
|
||||||
var token = session.Serialize();
|
var token = session.Serialize();
|
||||||
|
@ -213,7 +213,7 @@ public class Client : IFrostFSClient
|
||||||
return new ModelsV2.SessionToken(token);
|
return new ModelsV2.SessionToken(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Task<Session.SessionToken> CreateSessionInternalAsync(PrmCreateSession args)
|
internal Task<Session.SessionToken> CreateSessionInternalAsync(PrmSessionCreate args)
|
||||||
{
|
{
|
||||||
var service = GetSessionService(args);
|
var service = GetSessionService(args);
|
||||||
return service.CreateSessionAsync(args);
|
return service.CreateSessionAsync(args);
|
||||||
|
@ -229,7 +229,7 @@ public class Client : IFrostFSClient
|
||||||
|
|
||||||
private async void CheckFrostFsVersionSupport(Context? ctx = default)
|
private async void CheckFrostFsVersionSupport(Context? ctx = default)
|
||||||
{
|
{
|
||||||
var args = new PrmGetNodeInfo(ctx);
|
var args = new PrmNodeInfo(ctx);
|
||||||
var service = GetNetmapService(args);
|
var service = GetNetmapService(args);
|
||||||
var localNodeInfo = await service.GetLocalNodeInfoAsync(args);
|
var localNodeInfo = await service.GetLocalNodeInfoAsync(args);
|
||||||
|
|
||||||
|
|
|
@ -9,39 +9,39 @@ namespace FrostFS.SDK.ClientV2.Interfaces;
|
||||||
public interface IFrostFSClient : IDisposable
|
public interface IFrostFSClient : IDisposable
|
||||||
{
|
{
|
||||||
#region Network
|
#region Network
|
||||||
Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmGetNetmapSnapshot? args = null);
|
Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmNetmapSnapshot? args = null);
|
||||||
|
|
||||||
Task<NodeInfo> GetNodeInfoAsync(PrmGetNodeInfo? args = null);
|
Task<NodeInfo> GetNodeInfoAsync(PrmNodeInfo? args = null);
|
||||||
|
|
||||||
Task<NetworkSettings> GetNetworkSettingsAsync(PrmGetNetworkSettings? args = null);
|
Task<NetworkSettings> GetNetworkSettingsAsync(PrmNetworkSettings? args = null);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Session
|
#region Session
|
||||||
Task<SessionToken> CreateSessionAsync(PrmCreateSession args);
|
Task<SessionToken> CreateSessionAsync(PrmSessionCreate args);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Container
|
#region Container
|
||||||
Task<ModelsV2.Container> GetContainerAsync(PrmGetContainer args);
|
Task<ModelsV2.Container> GetContainerAsync(PrmContainerGet args);
|
||||||
|
|
||||||
IAsyncEnumerable<ContainerId> ListContainersAsync(PrmListContainer? args = null);
|
IAsyncEnumerable<ContainerId> ListContainersAsync(PrmContainerGetAll? args = null);
|
||||||
|
|
||||||
Task<ContainerId> CreateContainerAsync(PrmCreateContainer args);
|
Task<ContainerId> CreateContainerAsync(PrmContainerCreate args);
|
||||||
|
|
||||||
Task DeleteContainerAsync(PrmDeleteContainer args);
|
Task DeleteContainerAsync(PrmContainerDelete args);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Object
|
#region Object
|
||||||
Task<ObjectHeader> GetObjectHeadAsync(PrmGetObjectHead args);
|
Task<ObjectHeader> GetObjectHeadAsync(PrmObjectHeadGet args);
|
||||||
|
|
||||||
Task<FrostFsObject> GetObjectAsync(PrmGetObject args);
|
Task<FrostFsObject> GetObjectAsync(PrmObjectGet args);
|
||||||
|
|
||||||
Task<ObjectId> PutObjectAsync(PrmPutObject putObjectParameters);
|
Task<ObjectId> PutObjectAsync(PrmObjectPut putObjectParameters);
|
||||||
|
|
||||||
Task<ObjectId> PutSingleObjectAsync(PrmPutSingleObject args);
|
Task<ObjectId> PutSingleObjectAsync(PrmSingleObjectPut args);
|
||||||
|
|
||||||
Task DeleteObjectAsync(PrmDeleteObject args);
|
Task DeleteObjectAsync(PrmObjectDelete args);
|
||||||
|
|
||||||
IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmSearchObject args);
|
IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmObjectSearch args);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Tools
|
#region Tools
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmCreateContainer(ModelsV2.Container container) : IContext
|
public sealed class PrmContainerCreate(ModelsV2.Container container) : IContext
|
||||||
{
|
{
|
||||||
public ModelsV2.Container Container { get; set; } = container;
|
public ModelsV2.Container Container { get; set; } = container;
|
||||||
|
|
|
@ -3,7 +3,7 @@ using FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmDeleteContainer(ContainerId containerId, Context? ctx = null) : IContext
|
public sealed class PrmContainerDelete(ContainerId containerId, Context? ctx = null) : IContext
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
|
|
|
@ -3,7 +3,7 @@ using FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetContainer(ContainerId containerId, Context? ctx = null) : IContext
|
public sealed class PrmContainerGet(ContainerId containerId, Context? ctx = null) : IContext
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmListContainer() : IContext
|
public sealed class PrmContainerGetAll() : IContext
|
||||||
{
|
{
|
||||||
public string SessionToken { get; set; } = string.Empty;
|
public string SessionToken { get; set; } = string.Empty;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetNetmapSnapshot(Context? context = default) : IContext
|
public sealed class PrmNetmapSnapshot(Context? context = default) : IContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FrostFS request X-Headers
|
/// FrostFS request X-Headers
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetNetworkSettings(Context? context = default) : IContext
|
public sealed class PrmNetworkSettings(Context? context = default) : IContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FrostFS request X-Headers
|
/// FrostFS request X-Headers
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetNodeInfo(Context? context = default) : IContext
|
public sealed class PrmNodeInfo(Context? context = default) : IContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FrostFS request X-Headers
|
/// FrostFS request X-Headers
|
|
@ -3,7 +3,7 @@ using FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmDeleteObject(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
public sealed class PrmObjectDelete(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
public ObjectId ObjectId { get; set; } = objectId;
|
public ObjectId ObjectId { get; set; } = objectId;
|
|
@ -3,7 +3,7 @@ using FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetObject(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
public sealed class PrmObjectGet(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
public ObjectId ObjectId { get; set; } = objectId;
|
public ObjectId ObjectId { get; set; } = objectId;
|
|
@ -3,7 +3,7 @@ using FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmGetObjectHead(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
public sealed class PrmObjectHeadGet(ContainerId containerId, ObjectId objectId) : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
public ObjectId ObjectId { get; set; } = objectId;
|
public ObjectId ObjectId { get; set; } = objectId;
|
|
@ -3,7 +3,7 @@ using System.IO;
|
||||||
using FrostFS.SDK.ModelsV2;
|
using FrostFS.SDK.ModelsV2;
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmPutObject : IContext, ISessionToken
|
public sealed class PrmObjectPut : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Need to provide values like <c>ContainerId</c> and <c>ObjectType</c> to create and object.
|
/// Need to provide values like <c>ContainerId</c> and <c>ObjectType</c> to create and object.
|
|
@ -3,7 +3,7 @@ using System.Collections.Specialized;
|
||||||
using FrostFS.SDK.ModelsV2;
|
using FrostFS.SDK.ModelsV2;
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmSearchObject(ContainerId containerId, params ObjectFilter[] filters) : IContext, ISessionToken
|
public sealed class PrmObjectSearch(ContainerId containerId, params ObjectFilter[] filters) : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
public ContainerId ContainerId { get; set; } = containerId;
|
public ContainerId ContainerId { get; set; } = containerId;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmCreateSession(ulong expiration, Context? context = default) : IContext
|
public sealed class PrmSessionCreate(ulong expiration, Context? context = default) : IContext
|
||||||
{
|
{
|
||||||
public ulong Expiration { get; set; } = expiration;
|
public ulong Expiration { get; set; } = expiration;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using FrostFS.SDK.ModelsV2;
|
using FrostFS.SDK.ModelsV2;
|
||||||
namespace FrostFS.SDK.ClientV2.Parameters;
|
namespace FrostFS.SDK.ClientV2.Parameters;
|
||||||
|
|
||||||
public sealed class PrmPutSingleObject(FrostFsObject frostFsObject, Context? context = null) : IContext, ISessionToken
|
public sealed class PrmSingleObjectPut(FrostFsObject frostFsObject, Context? context = null) : IContext, ISessionToken
|
||||||
{
|
{
|
||||||
public FrostFsObject FrostFsObject { get; set; } = frostFsObject;
|
public FrostFsObject FrostFsObject { get; set; } = frostFsObject;
|
||||||
|
|
|
@ -23,7 +23,7 @@ internal class ContainerServiceProvider : ContextAccessor
|
||||||
containerServiceClient = service;
|
containerServiceClient = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<ModelsV2.Container> GetContainerAsync(PrmGetContainer args)
|
internal async Task<ModelsV2.Container> GetContainerAsync(PrmContainerGet args)
|
||||||
{
|
{
|
||||||
GetRequest request = GetContainerRequest(args.ContainerId.ToGrpcMessage(), args.XHeaders);
|
GetRequest request = GetContainerRequest(args.ContainerId.ToGrpcMessage(), args.XHeaders);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ internal class ContainerServiceProvider : ContextAccessor
|
||||||
return response.Body.Container.ToModel();
|
return response.Body.Container.ToModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async IAsyncEnumerable<ContainerId> ListContainersAsync(PrmListContainer args)
|
internal async IAsyncEnumerable<ContainerId> ListContainersAsync(PrmContainerGetAll args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ internal class ContainerServiceProvider : ContextAccessor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<ContainerId> CreateContainerAsync(PrmCreateContainer args)
|
internal async Task<ContainerId> CreateContainerAsync(PrmContainerCreate args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var grpcContainer = args.Container.ToGrpcMessage();
|
var grpcContainer = args.Container.ToGrpcMessage();
|
||||||
|
@ -87,7 +87,7 @@ internal class ContainerServiceProvider : ContextAccessor
|
||||||
return new ContainerId(Base58.Encode(response.Body.ContainerId.Value.ToByteArray()));
|
return new ContainerId(Base58.Encode(response.Body.ContainerId.Value.ToByteArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task DeleteContainerAsync(PrmDeleteContainer args)
|
internal async Task DeleteContainerAsync(PrmContainerDelete args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var request = new DeleteRequest
|
var request = new DeleteRequest
|
||||||
|
|
|
@ -40,7 +40,7 @@ internal class NetmapServiceProvider : ContextAccessor
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<NodeInfo> GetLocalNodeInfoAsync(PrmGetNodeInfo args)
|
internal async Task<NodeInfo> GetLocalNodeInfoAsync(PrmNodeInfo args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var request = new LocalNodeInfoRequest
|
var request = new LocalNodeInfoRequest
|
||||||
|
@ -72,7 +72,7 @@ internal class NetmapServiceProvider : ContextAccessor
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmGetNetmapSnapshot args)
|
internal async Task<NetmapSnapshot> GetNetmapSnapshotAsync(PrmNetmapSnapshot args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
{
|
{
|
||||||
readonly ObjectTools tools = new(ctx);
|
readonly ObjectTools tools = new(ctx);
|
||||||
|
|
||||||
internal async Task<ObjectHeader> GetObjectHeadAsync(PrmGetObjectHead args)
|
internal async Task<ObjectHeader> GetObjectHeadAsync(PrmObjectHeadGet args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var request = new HeadRequest
|
var request = new HeadRequest
|
||||||
|
@ -54,7 +54,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
return response.Body.Header.Header.ToModel();
|
return response.Body.Header.Header.ToModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<FrostFsObject> GetObjectAsync(PrmGetObject args)
|
internal async Task<FrostFsObject> GetObjectAsync(PrmObjectGet args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
return await GetObject(request, ctx);
|
return await GetObject(request, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task DeleteObjectAsync(PrmDeleteObject args)
|
internal async Task DeleteObjectAsync(PrmObjectDelete args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var request = new DeleteRequest
|
var request = new DeleteRequest
|
||||||
|
@ -114,7 +114,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
Verifier.CheckResponse(response);
|
Verifier.CheckResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmSearchObject args)
|
internal async IAsyncEnumerable<ObjectId> SearchObjectsAsync(PrmObjectSearch args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var request = new SearchRequest
|
var request = new SearchRequest
|
||||||
|
@ -148,7 +148,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Task<ObjectId> PutObjectAsync(PrmPutObject args)
|
internal Task<ObjectId> PutObjectAsync(PrmObjectPut args)
|
||||||
{
|
{
|
||||||
if (args.Header == null)
|
if (args.Header == null)
|
||||||
throw new ArgumentException("Value cannot be null", nameof(args.Header));
|
throw new ArgumentException("Value cannot be null", nameof(args.Header));
|
||||||
|
@ -162,7 +162,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
return PutStreamObject(args);
|
return PutStreamObject(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<ObjectId> PutSingleObjectAsync(PrmPutSingleObject args)
|
internal async Task<ObjectId> PutSingleObjectAsync(PrmSingleObjectPut args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var grpcObject = tools.CreateObject(args.FrostFsObject);
|
var grpcObject = tools.CreateObject(args.FrostFsObject);
|
||||||
|
@ -195,7 +195,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
|
|
||||||
static readonly AsyncLocal<Session.SessionToken> asyncLocalSession = new ();
|
static readonly AsyncLocal<Session.SessionToken> asyncLocalSession = new ();
|
||||||
|
|
||||||
private async Task<ObjectId> PutClientCutObject(PrmPutObject args)
|
private async Task<ObjectId> PutClientCutObject(PrmObjectPut args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var tokenRaw = await GetOrCreateSession(args, ctx);
|
var tokenRaw = await GetOrCreateSession(args, ctx);
|
||||||
|
@ -209,7 +209,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
|
|
||||||
FrostFsObject? currentObject;
|
FrostFsObject? currentObject;
|
||||||
|
|
||||||
var networkSettings = await Context.Client.GetNetworkSettingsAsync(new PrmGetNetworkSettings(ctx));
|
var networkSettings = await Context.Client.GetNetworkSettingsAsync(new PrmNetworkSettings(ctx));
|
||||||
|
|
||||||
var objectSize = (int)networkSettings.MaxObjectSize;
|
var objectSize = (int)networkSettings.MaxObjectSize;
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
if (largeObject.PayloadLength == fullLength)
|
if (largeObject.PayloadLength == fullLength)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
objectId = await PutSingleObjectAsync(new PrmPutSingleObject(currentObject, ctx) { SessionToken = token });
|
objectId = await PutSingleObjectAsync(new PrmSingleObjectPut(currentObject, ctx) { SessionToken = token });
|
||||||
|
|
||||||
sentObjectIds.Add(objectId!);
|
sentObjectIds.Add(objectId!);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
|
|
||||||
currentObject.SetParent(largeObject);
|
currentObject.SetParent(largeObject);
|
||||||
|
|
||||||
var putSingleObjectParams = new PrmPutSingleObject(currentObject, ctx) { SessionToken = token };
|
var putSingleObjectParams = new PrmSingleObjectPut(currentObject, ctx) { SessionToken = token };
|
||||||
|
|
||||||
objectId = await PutSingleObjectAsync(putSingleObjectParams);
|
objectId = await PutSingleObjectAsync(putSingleObjectParams);
|
||||||
|
|
||||||
|
@ -269,17 +269,17 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
|
|
||||||
linkObject.Header.Attributes.Clear();
|
linkObject.Header.Attributes.Clear();
|
||||||
|
|
||||||
_ = await PutSingleObjectAsync(new PrmPutSingleObject(linkObject, ctx){ SessionToken = token });
|
_ = await PutSingleObjectAsync(new PrmSingleObjectPut(linkObject, ctx){ SessionToken = token });
|
||||||
|
|
||||||
return tools.CalculateObjectId(largeObject.Header);
|
return tools.CalculateObjectId(largeObject.Header);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentObject.AddAttributes(args.Header!.Attributes);
|
currentObject.AddAttributes(args.Header!.Attributes);
|
||||||
|
|
||||||
return await PutSingleObjectAsync(new PrmPutSingleObject(currentObject, ctx));
|
return await PutSingleObjectAsync(new PrmSingleObjectPut(currentObject, ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ObjectId> PutStreamObject(PrmPutObject args)
|
private async Task<ObjectId> PutStreamObject(PrmObjectPut args)
|
||||||
{
|
{
|
||||||
var ctx = args.Context!;
|
var ctx = args.Context!;
|
||||||
var payload = args.Payload!;
|
var payload = args.Payload!;
|
||||||
|
@ -426,7 +426,7 @@ internal class ObjectServiceProvider(ObjectService.ObjectServiceClient client, C
|
||||||
{
|
{
|
||||||
if (args.SessionToken is null)
|
if (args.SessionToken is null)
|
||||||
{
|
{
|
||||||
return await Context.Client.CreateSessionInternalAsync(new PrmCreateSession(uint.MaxValue, ctx));
|
return await Context.Client.CreateSessionInternalAsync(new PrmSessionCreate(uint.MaxValue, ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Session.SessionToken().Deserialize(args.SessionToken.Token);
|
return new Session.SessionToken().Deserialize(args.SessionToken.Token);
|
||||||
|
|
|
@ -15,7 +15,7 @@ internal class SessionServiceProvider : ContextAccessor
|
||||||
_sessionServiceClient = sessionServiceClient;
|
_sessionServiceClient = sessionServiceClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<SessionToken> CreateSessionAsync(PrmCreateSession args)
|
internal async Task<SessionToken> CreateSessionAsync(PrmSessionCreate args)
|
||||||
{
|
{
|
||||||
var request = new CreateRequest
|
var request = new CreateRequest
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,12 +33,15 @@ public static class RequestConstructor
|
||||||
ObjectSessionContext.Types.Verb verb,
|
ObjectSessionContext.Types.Verb verb,
|
||||||
ECDsa key)
|
ECDsa key)
|
||||||
{
|
{
|
||||||
|
if (sessionToken.Body.Object?.Target != null)
|
||||||
|
return;
|
||||||
|
|
||||||
ObjectSessionContext.Types.Target target = new() { Container = address.ContainerId };
|
ObjectSessionContext.Types.Target target = new() { Container = address.ContainerId };
|
||||||
|
|
||||||
if (address.ObjectId != null)
|
if (address.ObjectId != null)
|
||||||
target.Objects.Add(address.ObjectId);
|
target.Objects.Add(address.ObjectId);
|
||||||
|
|
||||||
sessionToken.Body.Object = new()
|
sessionToken.Body.Object = new()
|
||||||
{
|
{
|
||||||
Target = target,
|
Target = target,
|
||||||
Verb = verb
|
Verb = verb
|
||||||
|
|
|
@ -21,6 +21,7 @@ public static class Extentions
|
||||||
var sha256 = SHA256.Create();
|
var sha256 = SHA256.Create();
|
||||||
return sha256.ComputeHash(value);
|
return sha256.ComputeHash(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ByteString Sha256(this IMessage data)
|
public static ByteString Sha256(this IMessage data)
|
||||||
{
|
{
|
||||||
return ByteString.CopyFrom(data.ToByteArray().Sha256());
|
return ByteString.CopyFrom(data.ToByteArray().Sha256());
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace FrostFS.SDK.ModelsV2;
|
|
||||||
|
|
||||||
public class Constants
|
|
||||||
{
|
|
||||||
public const int ObjectChunkSize = 3 * (1 << 20);
|
|
||||||
public const int Sha256HashLength = 32;
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
namespace FrostFS.SDK.ModelsV2;
|
|
||||||
|
|
||||||
public class GrpcCallInfo(string methodName, long elapsedMicroSec, bool hasError)
|
|
||||||
{
|
|
||||||
public string MethodName { get; set; } = methodName;
|
|
||||||
public long ElapsedTimeMicroSec { get; set; } = elapsedMicroSec;
|
|
||||||
public bool HasError { get; } = hasError;
|
|
||||||
}
|
|
25
src/FrostFS.SDK.ModelsV2/Misc/CheckSum.cs
Normal file
25
src/FrostFS.SDK.ModelsV2/Misc/CheckSum.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
|
public class CheckSum
|
||||||
|
{
|
||||||
|
public byte[]? Hash { get; set; }
|
||||||
|
|
||||||
|
public static byte[] GetHash(byte[] content)
|
||||||
|
{
|
||||||
|
var sha256 = SHA256.Create();
|
||||||
|
return sha256.ComputeHash(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckSum CreateCheckSum(byte[] content)
|
||||||
|
{
|
||||||
|
return new CheckSum { Hash = GetHash(content) };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Encoding.UTF8.GetString(Hash);
|
||||||
|
}
|
||||||
|
}
|
52
src/FrostFS.SDK.ModelsV2/Misc/Constants.cs
Normal file
52
src/FrostFS.SDK.ModelsV2/Misc/Constants.cs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
namespace FrostFS.SDK.ModelsV2;
|
||||||
|
|
||||||
|
public class Constants
|
||||||
|
{
|
||||||
|
public const int ObjectChunkSize = 3 * (1 << 20);
|
||||||
|
public const int Sha256HashLength = 32;
|
||||||
|
|
||||||
|
// HeaderPrefix is a prefix of key to object header value or property.
|
||||||
|
public const string HeaderPrefix = "$Object:";
|
||||||
|
|
||||||
|
// FilterHeaderVersion is a filter key to "version" field of the object header.
|
||||||
|
public const string FilterHeaderVersion = HeaderPrefix + "version";
|
||||||
|
|
||||||
|
// FilterHeaderObjectID is a filter key to "object_id" field of the object.
|
||||||
|
public const string FilterHeaderObjectID = HeaderPrefix + "objectID";
|
||||||
|
|
||||||
|
// FilterHeaderContainerID is a filter key to "container_id" field of the object header.
|
||||||
|
public const string FilterHeaderContainerID = HeaderPrefix + "containerID";
|
||||||
|
|
||||||
|
// FilterHeaderOwnerID is a filter key to "owner_id" field of the object header.
|
||||||
|
public const string FilterHeaderOwnerID = HeaderPrefix + "ownerID";
|
||||||
|
|
||||||
|
// FilterHeaderCreationEpoch is a filter key to "creation_epoch" field of the object header.
|
||||||
|
public const string FilterHeaderCreationEpoch = HeaderPrefix + "creationEpoch";
|
||||||
|
|
||||||
|
// FilterHeaderPayloadLength is a filter key to "payload_length" field of the object header.
|
||||||
|
public const string FilterHeaderPayloadLength = HeaderPrefix + "payloadLength";
|
||||||
|
|
||||||
|
// FilterHeaderPayloadHash is a filter key to "payload_hash" field of the object header.
|
||||||
|
public const string FilterHeaderPayloadHash = HeaderPrefix + "payloadHash";
|
||||||
|
|
||||||
|
// FilterHeaderObjectType is a filter key to "object_type" field of the object header.
|
||||||
|
public const string FilterHeaderObjectType = HeaderPrefix + "objectType";
|
||||||
|
|
||||||
|
// FilterHeaderHomomorphicHash is a filter key to "homomorphic_hash" field of the object header.
|
||||||
|
public const string FilterHeaderHomomorphicHash = HeaderPrefix + "homomorphicHash";
|
||||||
|
|
||||||
|
// FilterHeaderParent is a filter key to "split.parent" field of the object header.
|
||||||
|
public const string FilterHeaderParent = HeaderPrefix + "split.parent";
|
||||||
|
|
||||||
|
// FilterHeaderSplitID is a filter key to "split.splitID" field of the object header.
|
||||||
|
public const string FilterHeaderSplitID = HeaderPrefix + "split.splitID";
|
||||||
|
|
||||||
|
// FilterHeaderECParent is a filter key to "ec.parent" field of the object header.
|
||||||
|
public const string FilterHeaderECParent = HeaderPrefix + "ec.parent";
|
||||||
|
|
||||||
|
// FilterPropertyRoot is a filter key to check if regular object is on top of split hierarchy.
|
||||||
|
public const string FilterHeaderRoot = HeaderPrefix + "ROOT";
|
||||||
|
|
||||||
|
// FilterPropertyPhy is a filter key to check if an object physically stored on a node.
|
||||||
|
public const string FilterHeaderPhy = HeaderPrefix + "PHY";
|
||||||
|
}
|
|
@ -4,25 +4,16 @@ using FrostFS.SDK.ModelsV2.Enums;
|
||||||
|
|
||||||
namespace FrostFS.SDK.ModelsV2.Netmap;
|
namespace FrostFS.SDK.ModelsV2.Netmap;
|
||||||
|
|
||||||
public class NodeInfo
|
public class NodeInfo(
|
||||||
|
Version version,
|
||||||
|
NodeState state,
|
||||||
|
IReadOnlyCollection<string> addresses,
|
||||||
|
IReadOnlyDictionary<string, string> attributes,
|
||||||
|
ReadOnlyMemory<byte> publicKey)
|
||||||
{
|
{
|
||||||
public NodeInfo(
|
public NodeState State { get; private set; } = state;
|
||||||
Version version,
|
public Version Version { get; private set; } = version;
|
||||||
NodeState state,
|
public IReadOnlyCollection<string> Addresses { get; private set; } = addresses;
|
||||||
IReadOnlyCollection<string> addresses,
|
public IReadOnlyDictionary<string, string> Attributes { get; private set; } = attributes;
|
||||||
IReadOnlyDictionary<string, string> attributes,
|
public ReadOnlyMemory<byte> PublicKey { get; private set; } = publicKey;
|
||||||
ReadOnlyMemory<byte> publicKey)
|
|
||||||
{
|
|
||||||
Version = version;
|
|
||||||
State = state;
|
|
||||||
Addresses = addresses;
|
|
||||||
Attributes = attributes;
|
|
||||||
PublicKey = publicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NodeState State { get; private set; }
|
|
||||||
public Version Version { get; private set; }
|
|
||||||
public IReadOnlyCollection<string> Addresses { get; private set; }
|
|
||||||
public IReadOnlyDictionary<string, string> Attributes { get; private set; }
|
|
||||||
public ReadOnlyMemory<byte> PublicKey { get; private set; }
|
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ public class ContainerTest : ContainerTestsBase
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void CreateContainerTest()
|
public async void CreateContainerTest()
|
||||||
{
|
{
|
||||||
var param = new PrmCreateContainer(new ModelsV2.Container(BasicAcl.PublicRW, Mocker.PlacementPolicy));
|
var param = new PrmContainerCreate(new ModelsV2.Container(BasicAcl.PublicRW, Mocker.PlacementPolicy));
|
||||||
|
|
||||||
var result = await GetClient().CreateContainerAsync(param);
|
var result = await GetClient().CreateContainerAsync(param);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class ContainerTest : ContainerTestsBase
|
||||||
|
|
||||||
Mocker.Acl = BasicAcl.PublicRO;
|
Mocker.Acl = BasicAcl.PublicRO;
|
||||||
|
|
||||||
var result = await GetClient().GetContainerAsync(new PrmGetContainer(cid));
|
var result = await GetClient().GetContainerAsync(new PrmContainerGet(cid));
|
||||||
|
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(Mocker.Acl, result.BasicAcl);
|
Assert.Equal(Mocker.Acl, result.BasicAcl);
|
||||||
|
@ -104,7 +104,7 @@ public class ContainerTest : ContainerTestsBase
|
||||||
Mocker.ReturnContainerRemoved = true;
|
Mocker.ReturnContainerRemoved = true;
|
||||||
var cid = new ContainerId(Base58.Encode(Mocker.ContainerGuid.ToBytes()));
|
var cid = new ContainerId(Base58.Encode(Mocker.ContainerGuid.ToBytes()));
|
||||||
|
|
||||||
await GetClient().DeleteContainerAsync(new PrmDeleteContainer(cid));
|
await GetClient().DeleteContainerAsync(new PrmContainerDelete(cid));
|
||||||
|
|
||||||
Assert.Single(Mocker.Requests);
|
Assert.Single(Mocker.Requests);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ObjectTest : ObjectTestsBase
|
||||||
Timeout = TimeSpan.FromSeconds(2)
|
Timeout = TimeSpan.FromSeconds(2)
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await client.GetObjectAsync(new PrmGetObject(ContainerId, objectId) { Context = context });
|
var result = await client.GetObjectAsync(new PrmObjectGet(ContainerId, objectId) { Context = context });
|
||||||
|
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class ObjectTest : ObjectTestsBase
|
||||||
var bytes = new byte[1024];
|
var bytes = new byte[1024];
|
||||||
rnd.NextBytes(bytes);
|
rnd.NextBytes(bytes);
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = Mocker.ObjectHeader,
|
Header = Mocker.ObjectHeader,
|
||||||
Payload = new MemoryStream(bytes),
|
Payload = new MemoryStream(bytes),
|
||||||
|
@ -133,7 +133,7 @@ public class ObjectTest : ObjectTestsBase
|
||||||
byte[] bytes = File.ReadAllBytes(@".\..\..\..\TestData\cat.jpg");
|
byte[] bytes = File.ReadAllBytes(@".\..\..\..\TestData\cat.jpg");
|
||||||
var fileLength = bytes.Length;
|
var fileLength = bytes.Length;
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = Mocker.ObjectHeader,
|
Header = Mocker.ObjectHeader,
|
||||||
Payload = new MemoryStream(bytes),
|
Payload = new MemoryStream(bytes),
|
||||||
|
@ -197,7 +197,7 @@ public class ObjectTest : ObjectTestsBase
|
||||||
{
|
{
|
||||||
Mocker.ObjectId = new ObjectID { Value = ByteString.CopyFrom(SHA256.HashData(Encoding.UTF8.GetBytes("test"))) }.ToModel();
|
Mocker.ObjectId = new ObjectID { Value = ByteString.CopyFrom(SHA256.HashData(Encoding.UTF8.GetBytes("test"))) }.ToModel();
|
||||||
|
|
||||||
await GetClient().DeleteObjectAsync(new PrmDeleteObject(ContainerId, Mocker.ObjectId));
|
await GetClient().DeleteObjectAsync(new PrmObjectDelete(ContainerId, Mocker.ObjectId));
|
||||||
|
|
||||||
var request = Mocker.DeleteRequests.FirstOrDefault();
|
var request = Mocker.DeleteRequests.FirstOrDefault();
|
||||||
Assert.NotNull(request);
|
Assert.NotNull(request);
|
||||||
|
@ -210,7 +210,7 @@ public class ObjectTest : ObjectTestsBase
|
||||||
{
|
{
|
||||||
Mocker.ObjectId = new ObjectID { Value = ByteString.CopyFrom(SHA256.HashData(Encoding.UTF8.GetBytes("test"))) }.ToModel();
|
Mocker.ObjectId = new ObjectID { Value = ByteString.CopyFrom(SHA256.HashData(Encoding.UTF8.GetBytes("test"))) }.ToModel();
|
||||||
|
|
||||||
var response = await GetClient().GetObjectHeadAsync(new PrmGetObjectHead(ContainerId, Mocker.ObjectId));
|
var response = await GetClient().GetObjectHeadAsync(new PrmObjectHeadGet(ContainerId, Mocker.ObjectId));
|
||||||
|
|
||||||
var request = Mocker.HeadRequests.FirstOrDefault();
|
var request = Mocker.HeadRequests.FirstOrDefault();
|
||||||
Assert.NotNull(request);
|
Assert.NotNull(request);
|
||||||
|
|
|
@ -18,9 +18,9 @@ namespace FrostFS.SDK.SmokeTests;
|
||||||
|
|
||||||
public class SmokeTests
|
public class SmokeTests
|
||||||
{
|
{
|
||||||
private static PrmWait lightWait = new (100, 1);
|
private static readonly PrmWait lightWait = new (100, 1);
|
||||||
private readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
private readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
||||||
private readonly string url = "http://172.29.238.97:8080";
|
private readonly string url = "http://172.23.32.4:8080";
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void NetworkMapTest()
|
public async void NetworkMapTest()
|
||||||
|
@ -74,7 +74,7 @@ public class SmokeTests
|
||||||
{
|
{
|
||||||
using var client = Client.GetInstance(GetOptions(this.key, this.url));
|
using var client = Client.GetInstance(GetOptions(this.key, this.url));
|
||||||
|
|
||||||
var token = await client.CreateSessionAsync(new PrmCreateSession(100));
|
var token = await client.CreateSessionAsync(new PrmSessionCreate(100));
|
||||||
|
|
||||||
var session = new Session.SessionToken().Deserialize(token.Token);
|
var session = new Session.SessionToken().Deserialize(token.Token);
|
||||||
|
|
||||||
|
@ -100,9 +100,9 @@ public class SmokeTests
|
||||||
|
|
||||||
await Cleanup(client);
|
await Cleanup(client);
|
||||||
|
|
||||||
var token = await client.CreateSessionAsync(new PrmCreateSession(int.MaxValue));
|
var token = await client.CreateSessionAsync(new PrmSessionCreate(int.MaxValue));
|
||||||
|
|
||||||
var createContainerParam = new PrmCreateContainer(
|
var createContainerParam = new PrmContainerCreate(
|
||||||
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))));
|
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))));
|
||||||
|
|
||||||
createContainerParam.XHeaders.Add("key1", "value1");
|
createContainerParam.XHeaders.Add("key1", "value1");
|
||||||
|
@ -111,7 +111,7 @@ public class SmokeTests
|
||||||
|
|
||||||
var bytes = GetRandomBytes(1024);
|
var bytes = GetRandomBytes(1024);
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = new ObjectHeader(
|
Header = new ObjectHeader(
|
||||||
containerId: containerId,
|
containerId: containerId,
|
||||||
|
@ -124,7 +124,7 @@ public class SmokeTests
|
||||||
|
|
||||||
var objectId = await client.PutObjectAsync(param);
|
var objectId = await client.PutObjectAsync(param);
|
||||||
|
|
||||||
var @object = await client.GetObjectAsync(new PrmGetObject(containerId, objectId));
|
var @object = await client.GetObjectAsync(new PrmObjectGet(containerId, objectId));
|
||||||
|
|
||||||
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
||||||
MemoryStream ms = new(downloadedBytes);
|
MemoryStream ms = new(downloadedBytes);
|
||||||
|
@ -161,7 +161,7 @@ public class SmokeTests
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
var createContainerParam = new PrmCreateContainer(
|
var createContainerParam = new PrmContainerCreate(
|
||||||
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
||||||
{
|
{
|
||||||
Context = ctx
|
Context = ctx
|
||||||
|
@ -169,13 +169,13 @@ public class SmokeTests
|
||||||
|
|
||||||
var containerId = await client.CreateContainerAsync(createContainerParam);
|
var containerId = await client.CreateContainerAsync(createContainerParam);
|
||||||
|
|
||||||
var container = await client.GetContainerAsync(new PrmGetContainer(containerId,ctx));
|
var container = await client.GetContainerAsync(new PrmContainerGet(containerId,ctx));
|
||||||
Assert.NotNull(container);
|
Assert.NotNull(container);
|
||||||
Assert.True(callbackInvoked);
|
Assert.True(callbackInvoked);
|
||||||
|
|
||||||
var bytes = GetRandomBytes(objectSize);
|
var bytes = GetRandomBytes(objectSize);
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = new ObjectHeader(
|
Header = new ObjectHeader(
|
||||||
containerId: containerId,
|
containerId: containerId,
|
||||||
|
@ -194,11 +194,11 @@ public class SmokeTests
|
||||||
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
||||||
|
|
||||||
bool hasObject = false;
|
bool hasObject = false;
|
||||||
await foreach (var objId in client.SearchObjectsAsync(new PrmSearchObject(containerId) { Filters = [filter] }))
|
await foreach (var objId in client.SearchObjectsAsync(new PrmObjectSearch(containerId) { Filters = [filter] }))
|
||||||
{
|
{
|
||||||
hasObject = true;
|
hasObject = true;
|
||||||
|
|
||||||
var objHeader = await client.GetObjectHeadAsync(new PrmGetObjectHead(containerId, objectId));
|
var objHeader = await client.GetObjectHeadAsync(new PrmObjectHeadGet(containerId, objectId));
|
||||||
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
||||||
Assert.Single(objHeader.Attributes);
|
Assert.Single(objHeader.Attributes);
|
||||||
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
||||||
|
@ -207,7 +207,7 @@ public class SmokeTests
|
||||||
|
|
||||||
Assert.True(hasObject);
|
Assert.True(hasObject);
|
||||||
|
|
||||||
var @object = await client.GetObjectAsync(new PrmGetObject(containerId, objectId));
|
var @object = await client.GetObjectAsync(new PrmObjectGet(containerId, objectId));
|
||||||
|
|
||||||
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
||||||
MemoryStream ms = new(downloadedBytes);
|
MemoryStream ms = new(downloadedBytes);
|
||||||
|
@ -236,7 +236,7 @@ public class SmokeTests
|
||||||
{
|
{
|
||||||
using var client = Client.GetInstance(GetOptions(this.key, this.url));
|
using var client = Client.GetInstance(GetOptions(this.key, this.url));
|
||||||
|
|
||||||
var token = await client.CreateSessionAsync(new PrmCreateSession(int.MaxValue));
|
var token = await client.CreateSessionAsync(new PrmSessionCreate(int.MaxValue));
|
||||||
|
|
||||||
await Cleanup(client);
|
await Cleanup(client);
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public class SmokeTests
|
||||||
Callback = new((CallStatistics cs) => Assert.True(cs.ElapsedMicroSeconds > 0))
|
Callback = new((CallStatistics cs) => Assert.True(cs.ElapsedMicroSeconds > 0))
|
||||||
};
|
};
|
||||||
|
|
||||||
var createContainerParam = new PrmCreateContainer(
|
var createContainerParam = new PrmContainerCreate(
|
||||||
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
||||||
{
|
{
|
||||||
Context = ctx
|
Context = ctx
|
||||||
|
@ -254,12 +254,12 @@ public class SmokeTests
|
||||||
|
|
||||||
var containerId = await client.CreateContainerAsync(createContainerParam);
|
var containerId = await client.CreateContainerAsync(createContainerParam);
|
||||||
|
|
||||||
var container = await client.GetContainerAsync(new PrmGetContainer(containerId,ctx));
|
var container = await client.GetContainerAsync(new PrmContainerGet(containerId,ctx));
|
||||||
Assert.NotNull(container);
|
Assert.NotNull(container);
|
||||||
|
|
||||||
var bytes = GetRandomBytes(objectSize);
|
var bytes = GetRandomBytes(objectSize);
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = new ObjectHeader(
|
Header = new ObjectHeader(
|
||||||
containerId: containerId,
|
containerId: containerId,
|
||||||
|
@ -279,11 +279,11 @@ public class SmokeTests
|
||||||
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
||||||
|
|
||||||
bool hasObject = false;
|
bool hasObject = false;
|
||||||
await foreach (var objId in client.SearchObjectsAsync(new PrmSearchObject(containerId) { Filters = [filter], SessionToken = token }))
|
await foreach (var objId in client.SearchObjectsAsync(new PrmObjectSearch(containerId) { Filters = [filter], SessionToken = token }))
|
||||||
{
|
{
|
||||||
hasObject = true;
|
hasObject = true;
|
||||||
|
|
||||||
var objHeader = await client.GetObjectHeadAsync(new PrmGetObjectHead(containerId, objectId) { SessionToken = token });
|
var objHeader = await client.GetObjectHeadAsync(new PrmObjectHeadGet(containerId, objectId) { SessionToken = token });
|
||||||
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
||||||
Assert.Single(objHeader.Attributes);
|
Assert.Single(objHeader.Attributes);
|
||||||
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
||||||
|
@ -292,7 +292,7 @@ public class SmokeTests
|
||||||
|
|
||||||
Assert.True(hasObject);
|
Assert.True(hasObject);
|
||||||
|
|
||||||
var @object = await client.GetObjectAsync(new PrmGetObject(containerId, objectId) { SessionToken = token });
|
var @object = await client.GetObjectAsync(new PrmObjectGet(containerId, objectId) { SessionToken = token });
|
||||||
|
|
||||||
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
||||||
MemoryStream ms = new(downloadedBytes);
|
MemoryStream ms = new(downloadedBytes);
|
||||||
|
@ -325,7 +325,7 @@ public class SmokeTests
|
||||||
|
|
||||||
await Cleanup(client);
|
await Cleanup(client);
|
||||||
|
|
||||||
var createContainerParam = new PrmCreateContainer(new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
var createContainerParam = new PrmContainerCreate(new ModelsV2.Container(BasicAcl.PublicRW, new PlacementPolicy(true, new Replica(1))))
|
||||||
{
|
{
|
||||||
WaitParams = lightWait
|
WaitParams = lightWait
|
||||||
};
|
};
|
||||||
|
@ -338,13 +338,13 @@ public class SmokeTests
|
||||||
Interceptors = new([new MetricsInterceptor()])
|
Interceptors = new([new MetricsInterceptor()])
|
||||||
};
|
};
|
||||||
|
|
||||||
var container = await client.GetContainerAsync(new PrmGetContainer(containerId, context));
|
var container = await client.GetContainerAsync(new PrmContainerGet(containerId, context));
|
||||||
|
|
||||||
Assert.NotNull(container);
|
Assert.NotNull(container);
|
||||||
|
|
||||||
byte[] bytes = GetRandomBytes(objectSize);
|
byte[] bytes = GetRandomBytes(objectSize);
|
||||||
|
|
||||||
var param = new PrmPutObject
|
var param = new PrmObjectPut
|
||||||
{
|
{
|
||||||
Header = new ObjectHeader(
|
Header = new ObjectHeader(
|
||||||
containerId: containerId,
|
containerId: containerId,
|
||||||
|
@ -359,11 +359,11 @@ public class SmokeTests
|
||||||
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
var filter = new ObjectFilter(ObjectMatchType.Equals, "fileName", "test");
|
||||||
|
|
||||||
bool hasObject = false;
|
bool hasObject = false;
|
||||||
await foreach (var objId in client.SearchObjectsAsync(new PrmSearchObject(containerId, filter)))
|
await foreach (var objId in client.SearchObjectsAsync(new PrmObjectSearch(containerId, filter)))
|
||||||
{
|
{
|
||||||
hasObject = true;
|
hasObject = true;
|
||||||
|
|
||||||
var objHeader = await client.GetObjectHeadAsync(new PrmGetObjectHead(containerId, objectId));
|
var objHeader = await client.GetObjectHeadAsync(new PrmObjectHeadGet(containerId, objectId));
|
||||||
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
Assert.Equal((ulong)bytes.Length, objHeader.PayloadLength);
|
||||||
Assert.Single(objHeader.Attributes);
|
Assert.Single(objHeader.Attributes);
|
||||||
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
Assert.Equal("fileName", objHeader.Attributes.First().Key);
|
||||||
|
@ -372,7 +372,7 @@ public class SmokeTests
|
||||||
|
|
||||||
Assert.True(hasObject);
|
Assert.True(hasObject);
|
||||||
|
|
||||||
var @object = await client.GetObjectAsync(new PrmGetObject(containerId, objectId));
|
var @object = await client.GetObjectAsync(new PrmObjectGet(containerId, objectId));
|
||||||
|
|
||||||
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
var downloadedBytes = new byte[@object.Header.PayloadLength];
|
||||||
MemoryStream ms = new(downloadedBytes);
|
MemoryStream ms = new(downloadedBytes);
|
||||||
|
@ -425,7 +425,7 @@ public class SmokeTests
|
||||||
{
|
{
|
||||||
await foreach (var cid in client.ListContainersAsync())
|
await foreach (var cid in client.ListContainersAsync())
|
||||||
{
|
{
|
||||||
await client.DeleteContainerAsync(new PrmDeleteContainer(cid) { WaitParams = lightWait });
|
await client.DeleteContainerAsync(new PrmContainerDelete(cid) { WaitParams = lightWait });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,8 @@ public class MetricsInterceptor() : Interceptor
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
var elapsed = watch.ElapsedTicks * 1_000_000/Stopwatch.Frequency;
|
// Do somethins with call info
|
||||||
|
// var elapsed = watch.ElapsedTicks * 1_000_000/Stopwatch.Frequency;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue