[#28] Clients: Make immutable parameters
All checks were successful
lint-build / dotnet8.0 (pull_request) Successful in 55s
DCO / DCO (pull_request) Successful in 1m4s
lint-build / dotnet8.0 (push) Successful in 1m13s

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-12-02 19:33:45 +03:00
parent 749000a090
commit 9bb7b5eff8
62 changed files with 2742 additions and 963 deletions

View file

@ -1,14 +1,52 @@
namespace FrostFS.SDK.Client;
public sealed class PrmContainerDelete(FrostFsContainerId containerId, CallContext? ctx = null) : PrmBase(ctx), ISessionToken
public readonly struct PrmContainerDelete(
FrostFsContainerId containerId,
PrmWait waitParams,
FrostFsSessionToken? sessionToken = null,
string[]? xheaders = null) : ISessionToken, System.IEquatable<PrmContainerDelete>
{
public FrostFsContainerId ContainerId { get; set; } = containerId;
public FrostFsContainerId ContainerId { get; } = containerId;
/// <summary>
/// Since the container is removed with some delay, it needs to poll the container status
/// </summary>
/// <value>Rules for polling the result</value>
public PrmWait? WaitParams { get; set; }
public PrmWait WaitParams { get; } = waitParams;
public FrostFsSessionToken? SessionToken { get; set; }
public FrostFsSessionToken? SessionToken { get; } = sessionToken;
/// <summary>
/// FrostFS request X-Headers
/// </summary>
public string[] XHeaders { get; } = xheaders ?? [];
public override readonly bool Equals(object obj)
{
if (obj == null || obj is not PrmContainerDelete)
return false;
return Equals((PrmContainerDelete)obj);
}
public readonly bool Equals(PrmContainerDelete other)
{
return ContainerId == other.ContainerId
&& WaitParams.Equals(other.WaitParams);
}
public override int GetHashCode()
{
return ContainerId.GetHashCode() ^ WaitParams.GetHashCode();
}
public static bool operator ==(PrmContainerDelete left, PrmContainerDelete right)
{
return left.Equals(right);
}
public static bool operator !=(PrmContainerDelete left, PrmContainerDelete right)
{
return !(left == right);
}
}