Compare commits

..

7 commits

Author SHA1 Message Date
cf1fae8d2c span and memory 2024-11-12 04:00:26 +03:00
423b5a35b0 net standard 2.1 2024-11-12 00:52:48 +03:00
d4c88467d8 V2 removing 2024-11-12 00:35:07 +03:00
2a71ea3ff9 patch 2024-11-08 07:17:30 +03:00
c107a219b5 unicode fix 2024-11-01 10:40:07 +03:00
7125ecae64 pool part 2 2024-11-01 10:12:34 +03:00
c36a707cb5 temp 2024-10-21 10:36:57 +03:00
223 changed files with 1624 additions and 1663 deletions

View file

@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.ClientV2", "src\FrostFS.SDK.ClientV2\FrostFS.SDK.ClientV2.csproj", "{50D8F61F-C302-4AC9-8D8A-AB0B8C0988C3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.Client", "src\FrostFS.SDK.Client\FrostFS.SDK.Client.csproj", "{50D8F61F-C302-4AC9-8D8A-AB0B8C0988C3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.Cryptography", "src\FrostFS.SDK.Cryptography\FrostFS.SDK.Cryptography.csproj", "{3D804F4A-B0B2-47A5-B006-BE447BE64B50}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.ProtosV2", "src\FrostFS.SDK.ProtosV2\FrostFS.SDK.ProtosV2.csproj", "{5012EF96-9C9E-4E77-BC78-B4111EE54107}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.Protos", "src\FrostFS.SDK.Protos\FrostFS.SDK.Protos.csproj", "{5012EF96-9C9E-4E77-BC78-B4111EE54107}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrostFS.SDK.Tests", "src\FrostFS.SDK.Tests\FrostFS.SDK.Tests.csproj", "{8FDA7E0D-9C75-4874-988E-6592CD28F76C}"
EndProject

View file

@ -1,6 +1,6 @@
using Microsoft.Extensions.Caching.Memory;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
internal static class Caches
{

View file

@ -4,7 +4,7 @@ using FrostFS.SDK.Cryptography;
using Google.Protobuf;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class ClientKey(ECDsa key)
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class FrostFsException : Exception
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class FrostFsInvalidObjectException : FrostFsException
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class FrostFsResponseException : FrostFsException
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class FrostFsStreamException : FrostFsException
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class SessionExpiredException : FrostFsException
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class SessionNotFoundException : FrostFsException
{

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
@ -30,7 +30,7 @@
<ItemGroup>
<ProjectReference Include="..\FrostFS.SDK.Cryptography\FrostFS.SDK.Cryptography.csproj" />
<ProjectReference Include="..\FrostFS.SDK.ProtosV2\FrostFS.SDK.ProtosV2.csproj" />
<ProjectReference Include="..\FrostFS.SDK.Protos\FrostFS.SDK.Protos.csproj" />
</ItemGroup>
</Project>

View file

@ -10,8 +10,8 @@ using FrostFS.Accounting;
using FrostFS.Container;
using FrostFS.Netmap;
using FrostFS.Object;
using FrostFS.SDK.ClientV2.Interfaces;
using FrostFS.SDK.ClientV2.Services;
using FrostFS.SDK.Client.Interfaces;
using FrostFS.SDK.Client.Services;
using FrostFS.SDK.Cryptography;
using FrostFS.Session;
@ -21,7 +21,7 @@ using Grpc.Net.Client;
using Microsoft.Extensions.Options;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class FrostFSClient : IFrostFSClient
{
@ -175,7 +175,7 @@ public class FrostFSClient : IFrostFSClient
}
#region ApeManagerImplementation
public Task<byte[]> AddChainAsync(PrmApeChainAdd args)
public Task<ReadOnlyMemory<byte>> AddChainAsync(PrmApeChainAdd args)
{
if (args is null)
{
@ -285,6 +285,25 @@ public class FrostFSClient : IFrostFSClient
return service.GetObjectAsync(args);
}
public Task<RangeReader> GetRangeAsync(PrmRangeGet args)
{
if (args is null)
throw new ArgumentNullException(nameof(args));
var service = GetObjectService(args);
return service.GetRangeAsync(args);
}
public Task<IEnumerable<ReadOnlyMemory<byte>>> GetRangeHashAsync(PrmRangeHashGet args)
{
if (args is null)
throw new ArgumentNullException(nameof(args));
var service = GetObjectService(args);
return service.GetRangeHashAsync(args);
}
public Task<FrostFsObjectId> PutObjectAsync(PrmObjectPut args)
{
if (args is null)
@ -303,6 +322,17 @@ public class FrostFSClient : IFrostFSClient
return service.PutSingleObjectAsync(args);
}
public Task<FrostFsObjectId> PatchObjectAsync(PrmObjectPatch args)
{
if (args is null)
{
throw new ArgumentNullException(nameof(args));
}
var service = GetObjectService(args);
return service.PatchObjectAsync(args);
}
public Task DeleteObjectAsync(PrmObjectDelete args)
{
if (args is null)

View file

@ -5,4 +5,4 @@
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Security", "CA5394:Do not use insecure randomness", Justification = "<Pending>", Scope = "member", Target = "~M:FrostFS.SDK.ClientV2.Sampler.Next~System.Int32")]
[assembly: SuppressMessage("Security", "CA5394:Do not use insecure randomness", Justification = "<Pending>", Scope = "member", Target = "~M:FrostFS.SDK.Client.Sampler.Next~System.Int32")]

View file

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods",
Justification = "parameters are provided by GRPC infrastructure")]

View file

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods",
Justification = "parameters are provided by GRPC infrastructure")]

View file

@ -3,7 +3,8 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Frostfs.V2.Ape;
namespace FrostFS.SDK.ClientV2.Interfaces;
namespace FrostFS.SDK.Client.Interfaces;
public interface IFrostFSClient : IDisposable
{
@ -20,7 +21,7 @@ public interface IFrostFSClient : IDisposable
#endregion
#region ApeManager
Task<byte[]> AddChainAsync(PrmApeChainAdd args);
Task<ReadOnlyMemory<byte>> AddChainAsync(PrmApeChainAdd args);
Task RemoveChainAsync(PrmApeChainRemove args);
@ -42,10 +43,16 @@ public interface IFrostFSClient : IDisposable
Task<FrostFsObject> GetObjectAsync(PrmObjectGet args);
Task<RangeReader> GetRangeAsync(PrmRangeGet args);
Task<IEnumerable<ReadOnlyMemory<byte>>> GetRangeHashAsync(PrmRangeHashGet args);
Task<FrostFsObjectId> PutObjectAsync(PrmObjectPut args);
Task<FrostFsObjectId> PutSingleObjectAsync(PrmSingleObjectPut args);
Task<FrostFsObjectId> PatchObjectAsync(PrmObjectPatch args);
Task DeleteObjectAsync(PrmObjectDelete args);
IAsyncEnumerable<FrostFsObjectId> SearchObjectsAsync(PrmObjectSearch args);

View file

@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
internal static partial class FrostFsMessages
{

View file

@ -3,7 +3,7 @@ using System.Linq;
using FrostFS.SDK.Cryptography;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ContainerMapper
{

View file

@ -7,7 +7,7 @@ using Google.Protobuf;
using Microsoft.Extensions.Caching.Memory;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ContainerIdMapper
{
@ -33,7 +33,16 @@ public static class ContainerIdMapper
Caches.Containers.Set(containerId, message, _oneHourExpiration);
}
return message!;
}
public static FrostFsContainerId ToModel(this ContainerID message)
{
if (message is null)
{
throw new ArgumentNullException(nameof(message));
}
return new FrostFsContainerId(Base58.Encode(message.Value.Span));
}
}

View file

@ -2,7 +2,7 @@ using System;
using FrostFS.Session;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class MetaHeaderMapper
{

View file

@ -3,7 +3,7 @@ using System.Linq;
using FrostFS.Netmap;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public static class NetmapMapper
{

View file

@ -2,9 +2,9 @@ using System;
using System.Linq;
using FrostFS.Netmap;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client.Mappers.GRPC;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public static class NodeInfoMapper
{
@ -39,7 +39,7 @@ public static class NodeInfoMapper
state: state,
addresses: [.. nodeInfo.Addresses],
attributes: nodeInfo.Attributes.ToDictionary(n => n.Key, n => n.Value),
publicKey: nodeInfo.PublicKey.ToByteArray()
publicKey: nodeInfo.PublicKey.Memory
);
}
}

View file

@ -3,7 +3,7 @@ using System.Linq;
using FrostFS.Netmap;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public static class PlacementPolicyMapper
{

View file

@ -2,7 +2,7 @@ using System;
using FrostFS.Netmap;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public static class ReplicaMapper
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
internal static class ObjectMapper
{
@ -6,7 +6,7 @@ internal static class ObjectMapper
{
return new FrostFsObject(obj.Header.ToModel())
{
ObjectId = FrostFsObjectId.FromHash(obj.ObjectId.Value.ToByteArray())
ObjectId = FrostFsObjectId.FromHash(obj.ObjectId.Value.Span)
};
}
}

View file

@ -2,7 +2,7 @@ using System;
using FrostFS.Object;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ObjectAttributeMapper
{

View file

@ -2,7 +2,7 @@ using System;
using FrostFS.Object;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ObjectFilterMapper
{

View file

@ -5,7 +5,7 @@ using System.Linq;
using FrostFS.Object;
using FrostFS.SDK.Cryptography;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ObjectHeaderMapper
{
@ -40,7 +40,7 @@ public static class ObjectHeaderMapper
}
var model = new FrostFsObjectHeader(
new FrostFsContainerId(Base58.Encode(header.ContainerId.Value.ToByteArray())),
new FrostFsContainerId(Base58.Encode(header.ContainerId.Value.Span)),
objTypeName,
header.Attributes.Select(attribute => attribute.ToModel()).ToArray(),
split,

View file

@ -4,7 +4,7 @@ using FrostFS.Refs;
using Google.Protobuf;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class ObjectIdMapper
{
@ -28,6 +28,6 @@ public static class ObjectIdMapper
throw new ArgumentNullException(nameof(objectId));
}
return FrostFsObjectId.FromHash(objectId.Value.ToByteArray());
return FrostFsObjectId.FromHash(objectId.Value.Span);
}
}

View file

@ -7,7 +7,7 @@ using Google.Protobuf;
using Microsoft.Extensions.Caching.Memory;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class OwnerIdMapper
{
@ -44,7 +44,7 @@ public static class OwnerIdMapper
if (!Caches.Owners.TryGetValue(message, out FrostFsOwner? model))
{
model = new FrostFsOwner(Base58.Encode(message.Value.ToByteArray()));
model = new FrostFsOwner(Base58.Encode(message.Value.Span));
Caches.Owners.Set(message, model, _oneHourExpiration);
}

View file

@ -2,7 +2,7 @@ using System;
using Google.Protobuf;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public static class SessionMapper
{

View file

@ -2,7 +2,7 @@ using System;
using Google.Protobuf;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class SignatureMapper
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class StatusMapper
{

View file

@ -3,7 +3,7 @@ using System.Threading;
using FrostFS.Refs;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
namespace FrostFS.SDK.Client.Mappers.GRPC;
public static class VersionMapper
{

View file

@ -2,7 +2,7 @@
using Frostfs.V2.Ape;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public struct FrostFsChainTarget(FrostFsTargetType type, string name) : IEquatable<FrostFsChainTarget>
{
@ -42,7 +42,7 @@ public struct FrostFsChainTarget(FrostFsTargetType type, string name) : IEquatab
public override readonly int GetHashCode()
{
return $"{Name}{Type}".GetHashCode();
return $"{Name}{Type}".GetHashCode(StringComparison.InvariantCulture);
}
public static bool operator ==(FrostFsChainTarget left, FrostFsChainTarget right)

View file

@ -1,6 +1,6 @@
using Google.Protobuf;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public struct FrostFsChain(byte[] raw) : System.IEquatable<FrostFsChain>
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public enum FrostFsTargetType
{

View file

@ -1,6 +1,6 @@
using FrostFS.Refs;
using FrostFS.SDK.ClientV2;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client;
using FrostFS.SDK.Client.Mappers.GRPC;
using FrostFS.SDK.Cryptography;
namespace FrostFS.SDK;
@ -27,7 +27,7 @@ public class FrostFsContainerId
if (containerID != null)
{
this.modelId = Base58.Encode(containerID.Value.ToByteArray());
this.modelId = Base58.Encode(containerID.Value.Span);
return this.modelId;
}

View file

@ -2,8 +2,8 @@ using System;
using System.Collections.ObjectModel;
using System.Linq;
using FrostFS.SDK.ClientV2;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client;
using FrostFS.SDK.Client.Mappers.GRPC;
using FrostFS.SDK.Cryptography;
using Google.Protobuf;

View file

@ -16,6 +16,6 @@ public class CheckSum
public override string ToString()
{
return text ??= BitConverter.ToString(hash).Replace("-", "");
return text ??= BitConverter.ToString(hash).Replace("-", "", StringComparison.InvariantCulture);
}
}

View file

@ -3,7 +3,7 @@ using System;
using System.Linq;
using FrostFS.Netmap;
using FrostFS.SDK.ClientV2;
using FrostFS.SDK.Client;
namespace FrostFS.SDK;

View file

@ -27,7 +27,7 @@ public struct FrostFsReplica : IEquatable<FrostFsReplica>
public override readonly int GetHashCode()
{
return Count + Selector.GetHashCode();
return Count + Selector.GetHashCode(StringComparison.InvariantCulture);
}
public static bool operator ==(FrostFsReplica left, FrostFsReplica right)

View file

@ -1,5 +1,5 @@
using FrostFS.Refs;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client.Mappers.GRPC;
namespace FrostFS.SDK;

View file

@ -0,0 +1,48 @@
using FrostFS.Refs;
using FrostFS.SDK.Client.Mappers.GRPC;
namespace FrostFS.SDK;
public class FrostFsAddress
{
private FrostFsObjectId? frostFsObjectId;
private FrostFsContainerId? frostFsContainerId;
private ObjectID? objectId;
private ContainerID? containerId;
public FrostFsAddress(FrostFsContainerId frostFsContainerId, FrostFsObjectId frostFsObjectId)
{
FrostFsObjectId = frostFsObjectId ?? throw new System.ArgumentNullException(nameof(frostFsObjectId));
FrostFsContainerId = frostFsContainerId ?? throw new System.ArgumentNullException(nameof(frostFsContainerId));
}
internal FrostFsAddress(ObjectID objectId, ContainerID containerId)
{
ObjectId = objectId ?? throw new System.ArgumentNullException(nameof(objectId));
ContainerId = containerId ?? throw new System.ArgumentNullException(nameof(containerId));
}
public FrostFsObjectId FrostFsObjectId
{
get => frostFsObjectId ??= objectId!.ToModel();
set => frostFsObjectId = value;
}
public FrostFsContainerId FrostFsContainerId
{
get => frostFsContainerId ??= containerId!.ToModel();
set => frostFsContainerId = value;
}
public ObjectID ObjectId
{
get => objectId ??= frostFsObjectId!.ToMessage();
set => objectId = value;
}
public ContainerID ContainerId
{
get => containerId ??= frostFsContainerId!.ToMessage();
set => containerId = value;
}
}

View file

@ -4,7 +4,7 @@ using System.Linq;
using FrostFS.Object;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client.Mappers.GRPC;
namespace FrostFS.SDK;

View file

@ -8,13 +8,8 @@ public class FrostFsObjectId(string id)
{
public string Value { get; } = id;
public static FrostFsObjectId FromHash(byte[] hash)
public static FrostFsObjectId FromHash(ReadOnlySpan<byte> hash)
{
if (hash is null)
{
throw new ArgumentNullException(nameof(hash));
}
if (hash.Length != Constants.Sha256HashLength)
throw new FormatException("ObjectID must be a sha256 hash.");

View file

@ -1,7 +1,7 @@
using System.Security.Cryptography;
using FrostFS.Refs;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Client.Mappers.GRPC;
using FrostFS.SDK.Cryptography;
namespace FrostFS.SDK;

View file

@ -0,0 +1,29 @@
using System;
namespace FrostFS.SDK;
public readonly struct FrostFsRange(ulong offset, ulong length) : System.IEquatable<FrostFsRange>
{
public ulong Offset { get; } = offset;
public ulong Length { get; } = length;
public override readonly bool Equals(object obj) => this == (FrostFsRange)obj;
public override readonly int GetHashCode() => $"{Offset}{Length}".GetHashCode(StringComparison.InvariantCulture);
public static bool operator ==(FrostFsRange left, FrostFsRange right)
{
return left.Equals(right);
}
public static bool operator !=(FrostFsRange left, FrostFsRange right)
{
return !(left == right);
}
public readonly bool Equals(FrostFsRange other)
{
return this == other;
}
}

View file

@ -6,5 +6,5 @@ namespace FrostFS.SDK;
public interface IObjectReader : IDisposable
{
Task<ReadOnlyMemory<byte>?> ReadChunk(CancellationToken cancellationToken = default);
ValueTask<ReadOnlyMemory<byte>?> ReadChunk(CancellationToken cancellationToken = default);
}

View file

@ -9,7 +9,7 @@ using Google.Protobuf;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class CallContext()
{

View file

@ -1,6 +1,6 @@
using System.Security.Cryptography;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class Credentials(ECDsa key, FrostFsOwner ownerId)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public interface IContext
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public interface ISessionToken
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmApeChainList(FrostFsChainTarget target, CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmApeChainRemove(FrostFsChainTarget target, FrostFsChain chain, CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmApeChainAdd(FrostFsChainTarget target, FrostFsChain chain, CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmBalance(CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,6 +1,6 @@
using System.Collections.Specialized;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class PrmBase(CallContext? ctx, NameValueCollection? xheaders = null) : IContext
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmContainerCreate(FrostFsContainerInfo container, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmContainerDelete(FrostFsContainerId containerId, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmContainerGet(FrostFsContainerId container, CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmContainerGetAll(CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmNetmapSnapshot(CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmNetworkSettings(CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmNodeInfo(CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectDelete(FrostFsContainerId containerId, FrostFsObjectId objectId, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectGet(FrostFsContainerId containerId, FrostFsObjectId objectId, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectHeadGet(FrostFsContainerId containerId, FrostFsObjectId objectId, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -0,0 +1,24 @@
using System.IO;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectPatch(FrostFsAddress address, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{
public FrostFsAddress Address { get; } = address;
public FrostFsRange Range { get; set; }
/// <summary>
/// A stream with source data
/// </summary>
public Stream? Payload { get; set; }
public FrostFsAttributePair[]? NewAttributes { get; set; }
public bool ReplaceAttributes { get; set; }
public int MaxPayloadPatchChunkLength { get; set; }
/// <inheritdoc />
public FrostFsSessionToken? SessionToken { get; set; }
}

View file

@ -1,6 +1,6 @@
using System.IO;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectPut(CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmObjectSearch(FrostFsContainerId containerId, CallContext? ctx = null, params IObjectFilter[] filters) : PrmBase(ctx), ISessionToken
{

View file

@ -0,0 +1,20 @@
namespace FrostFS.SDK.Client;
public sealed class PrmRangeGet(
FrostFsContainerId containerId,
FrostFsObjectId objectId,
FrostFsRange range,
bool raw = false,
CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{
public FrostFsContainerId ContainerId { get; } = containerId;
public FrostFsObjectId ObjectId { get; } = objectId;
public FrostFsRange Range { get; } = range;
public bool Raw { get; } = raw;
/// <inheritdoc />
public FrostFsSessionToken? SessionToken { get; set; }
}

View file

@ -0,0 +1,20 @@
namespace FrostFS.SDK.Client;
public sealed class PrmRangeHashGet(
FrostFsContainerId containerId,
FrostFsObjectId objectId,
FrostFsRange[] ranges,
byte[] salt,
CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{
public FrostFsContainerId ContainerId { get; } = containerId;
public FrostFsObjectId ObjectId { get; } = objectId;
public FrostFsRange[] Ranges { get; } = ranges;
public byte[] Salt { get; } = salt;
/// <inheritdoc />
public FrostFsSessionToken? SessionToken { get; set; }
}

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmSessionCreate(ulong expiration, CallContext? ctx = null) : PrmBase(ctx)
{

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public sealed class PrmSingleObjectPut(FrostFsObject frostFsObject, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
{

View file

@ -1,6 +1,6 @@
using System;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public class PrmWait(TimeSpan timeout, TimeSpan pollInterval)
{

View file

@ -3,7 +3,7 @@ using System.Threading;
using Microsoft.Extensions.Logging;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
// clientStatusMonitor count error rate and other statistics for connection.
public class ClientStatusMonitor : IClientStatus

View file

@ -3,7 +3,7 @@ using System.Threading.Tasks;
using Grpc.Core;
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
// clientWrapper is used by default, alternative implementations are intended for testing purposes only.
public class ClientWrapper : ClientStatusMonitor
@ -101,36 +101,44 @@ public class ClientWrapper : ClientStatusMonitor
await ScheduleGracefulClose().ConfigureAwait(false);
}
#pragma warning disable CA2000 // Dispose objects before losing scope: will be disposed manually
FrostFSClient client = new(WrapperPrm, sessionCache);
#pragma warning restore CA2000
//TODO: set additioanl params
var error = await client.Dial(ctx).ConfigureAwait(false);
if (!string.IsNullOrEmpty(error))
{
SetUnhealthyOnDial();
return wasHealthy;
}
lock (_lock)
{
Client = client;
}
FrostFSClient? client = null;
try
{
var prmNodeInfo = new PrmNodeInfo(ctx);
var res = await client.GetNodeInfoAsync(prmNodeInfo).ConfigureAwait(false);
}
catch (FrostFsException)
{
SetUnhealthy();
return wasHealthy;
}
client = new(WrapperPrm, sessionCache);
SetHealthy();
return !wasHealthy;
//TODO: set additioanl params
var error = await client.Dial(ctx).ConfigureAwait(false);
if (!string.IsNullOrEmpty(error))
{
SetUnhealthyOnDial();
return wasHealthy;
}
lock (_lock)
{
Client = client;
client = null;
}
try
{
var prmNodeInfo = new PrmNodeInfo(ctx);
var res = await Client.GetNodeInfoAsync(prmNodeInfo).ConfigureAwait(false);
}
catch (FrostFsException)
{
SetUnhealthy();
return wasHealthy;
}
SetHealthy();
return !wasHealthy;
}
finally
{
client?.Dispose();
}
}
internal void IncRequests(ulong elapsed, MethodIndex method)

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
// values for healthy status of clientStatusMonitor.
public enum HealthyStatus

View file

@ -1,4 +1,4 @@
namespace FrostFS.SDK.ClientV2;
namespace FrostFS.SDK.Client;
public interface IClientStatus
{

Some files were not shown because too many files have changed in this diff Show more