frostfs-sdk-csharp/src/FrostFS.SDK.ClientV2/Parameters/PrmWait.cs
Pavel Gross 7b9c19f37c
All checks were successful
DCO / DCO (pull_request) Successful in 47s
[#17] Client: Add extra parameter
API methods' parameters types with optional session, polling settings, xHeaders etc. and corresponding handlers have been added

Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-07-18 15:33:40 +03:00

23 lines
812 B
C#

using System;
namespace FrostFS.SDK.ClientV2.Parameters;
public class PrmWait(TimeSpan timeout, TimeSpan pollInterval)
{
private static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(120);
private static TimeSpan DefaultPollInterval = TimeSpan.FromSeconds(5);
public PrmWait(int timeout, int interval) : this(TimeSpan.FromSeconds(timeout), TimeSpan.FromSeconds(interval))
{
}
public static PrmWait DefaultParams { get; } = new PrmWait(DefaultTimeout, DefaultPollInterval);
public TimeSpan Timeout { get; set; } = timeout.Ticks == 0 ? DefaultTimeout : timeout;
public TimeSpan PollInterval { get; set; } = pollInterval.Ticks == 0 ? DefaultPollInterval : pollInterval;
public DateTime GetDeadline()
{
return DateTime.UtcNow.AddTicks(Timeout.Ticks);
}
}