frostfs-sdk-csharp/src/FrostFS.SDK.ClientV2/Tools/ClientEnvironment.cs
Pavel Gross 0ddde467cd [#20] Client: Optimize memory usage
Avoid memory allocation, use cache and static

Signed-off-by: Pavel Gross <p.gross@yando.com>
2024-08-01 16:18:19 +03:00

34 lines
897 B
C#

using FrostFS.SDK.ModelsV2;
using Google.Protobuf;
using Grpc.Net.Client;
using System;
using System.Security.Cryptography;
using FrostFS.SDK.Cryptography;
namespace FrostFS.SDK.ClientV2;
public class ClientEnvironment(Client client, ECDsa key, OwnerId owner, GrpcChannel channel, ModelsV2.Version version) : IDisposable
{
internal OwnerId Owner { get; } = owner;
internal GrpcChannel Channel { get; private set; } = channel;
internal ModelsV2.Version Version { get; } = version;
internal NetworkSettings? NetworkSettings { get; set; }
internal Client Client { get; } = client;
internal ClientKey Key { get; } = new ClientKey(key);
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Channel.Dispose();
}
}
}