[#23] Client: Refactoring to optimize memory usage

Signed-off-by: Pavel Gross <p.gross@yando.com>
This commit is contained in:
Pavel Gross 2024-09-11 10:44:30 +03:00
parent 1a02ac2ae7
commit 6562aa27a5
141 changed files with 1722 additions and 896 deletions

View file

@ -2,9 +2,11 @@ using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Threading;
using FrostFS.SDK.ModelsV2;
using FrostFS.SDK.Cryptography;
using Google.Protobuf;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
@ -13,13 +15,13 @@ public class Context()
{
private List<Interceptor>? interceptors;
private ByteString publicKeyCache;
private ByteString? publicKeyCache;
public ECDsa Key { get; set; }
public OwnerId OwnerId { get; set; }
public FrostFsOwner OwnerId { get; set; }
public ModelsV2.Version Version { get; set; }
public FrostFsVersion Version { get; set; }
public CancellationToken CancellationToken { get; set; } = default;
@ -35,16 +37,13 @@ public class Context()
set { this.interceptors = value; }
}
public ByteString PublicKeyCache
public ByteString? GetPublicKeyCache()
{
get
if (publicKeyCache == null && Key != null)
{
if (publicKeyCache == null)
{
publicKeyCache = ByteString.CopyFrom(Key.PublicKey());
}
return publicKeyCache;
publicKeyCache = ByteString.CopyFrom(Key.PublicKey());
}
return publicKeyCache;
}
}