[#14] Add interceptors

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-07-01 11:56:47 +03:00 committed by p.gross
parent 605463ec24
commit ae67b12313
28 changed files with 943 additions and 554 deletions

View file

@ -1,13 +1,26 @@
using System;
using System.Collections.Generic;
using System.Threading;
using FrostFS.SDK.ModelsV2;
using Grpc.Core.Interceptors;
namespace FrostFS.SDK.ClientV2;
public class Context()
{
private List<Interceptor> interceptors;
public CancellationToken CancellationToken { get; set; } = default;
public TimeSpan Timeout { get; set; } = default;
public string SessionToken { get; set; } = string.Empty;
public DateTime? Deadline => Timeout.Ticks > 0 ? DateTime.UtcNow.Add(Timeout) : null;
public Action<CallStatistics> Callback { get; set; }
public List<Interceptor> Interceptors
{
get { return interceptors ??= []; }
set { interceptors = value; }
}
}