Avoid memory allocation, use cache and static Signed-off-by: Pavel Gross <p.gross@yando.com>
34 lines
897 B
C#
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();
|
|
}
|
|
}
|
|
}
|