frostfs-sdk-csharp/src/FrostFS.SDK.Client/Tools/ClientContext.cs
Pavel Gross c9418a1894 [#28] Client: Use external GRPC Channnel
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-12-06 09:01:33 +03:00

48 lines
1.2 KiB
C#

using System;
using System.Collections.ObjectModel;
using Grpc.Core;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.Client;
public class ClientContext(FrostFSClient client, ClientKey key, FrostFsOwner owner, ChannelBase channel, FrostFsVersion version)
{
private string? sessionKey;
internal FrostFsOwner Owner { get; } = owner;
internal string? Address { get; } = channel.Target;
internal ChannelBase Channel { get; private set; } = channel;
internal FrostFsVersion Version { get; } = version;
internal NetworkSettings? NetworkSettings { get; set; }
internal FrostFSClient Client { get; } = client;
internal ClientKey Key { get; } = key;
internal SessionCache? SessionCache { get; set; }
internal Action<CallStatistics>? Callback { get; set; }
internal Collection<Interceptor>? Interceptors { get; set; }
internal Action<Exception>? PoolErrorHandler { get; set; }
internal string? SessionCacheKey
{
get
{
if (sessionKey == null && Key != null && Address != null)
{
sessionKey = Pool.FormCacheKey(Address, Key.PublicKey);
}
return sessionKey;
}
}
}