[#24] Client: Implement pool part1

first iteration - base classes and methods

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-10-21 10:48:00 +03:00
parent d1271df207
commit c9a75ea025
72 changed files with 2786 additions and 468 deletions

View file

@ -0,0 +1,49 @@
using System;
using System.Collections.ObjectModel;
using System.Security.Cryptography;
using System.Threading;
using FrostFS.SDK.Cryptography;
using Google.Protobuf;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
public class CallContext()
{
private ReadOnlyCollection<Interceptor>? interceptors;
private ByteString? publicKeyCache;
public ECDsa? Key { get; set; }
public FrostFsOwner? OwnerId { get; set; }
public FrostFsVersion? Version { get; set; }
public CancellationToken CancellationToken { get; set; }
public TimeSpan Timeout { get; set; }
public DateTime? Deadline => Timeout.Ticks > 0 ? DateTime.UtcNow.Add(Timeout) : null;
public Action<CallStatistics>? Callback { get; set; }
public ReadOnlyCollection<Interceptor>? Interceptors
{
get { return this.interceptors; }
set { this.interceptors = value; }
}
public ByteString? GetPublicKeyCache()
{
if (publicKeyCache == null && Key != null)
{
publicKeyCache = ByteString.CopyFrom(Key.PublicKey());
}
return publicKeyCache;
}
}