[#28] Clients: Make immutable parameters
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
749000a090
commit
9bb7b5eff8
62 changed files with 2742 additions and 963 deletions
|
@ -1,21 +1,59 @@
|
|||
using System.Collections.Generic;
|
||||
namespace FrostFS.SDK.Client;
|
||||
|
||||
namespace FrostFS.SDK.Client;
|
||||
|
||||
public sealed class PrmObjectSearch(FrostFsContainerId containerId, CallContext? ctx = null, params IObjectFilter[] filters) : PrmBase(ctx), ISessionToken
|
||||
public readonly struct PrmObjectSearch(
|
||||
FrostFsContainerId containerId,
|
||||
FrostFsSessionToken? token,
|
||||
string[]? xheaders = null,
|
||||
params IObjectFilter[] filters) : ISessionToken, System.IEquatable<PrmObjectSearch>
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines container for the search
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public FrostFsContainerId ContainerId { get; set; } = containerId;
|
||||
public FrostFsContainerId ContainerId { get; } = containerId;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the search criteria
|
||||
/// </summary>
|
||||
/// <value>Collection of filters</value>
|
||||
public IEnumerable<IObjectFilter> Filters { get; set; } = filters;
|
||||
public IObjectFilter[] Filters { get; } = filters;
|
||||
|
||||
/// <inheritdoc />
|
||||
public FrostFsSessionToken? SessionToken { get; set; }
|
||||
public FrostFsSessionToken? SessionToken { get; } = token;
|
||||
|
||||
/// <summary>
|
||||
/// FrostFS request X-Headers
|
||||
/// </summary>
|
||||
public string[] XHeaders { get; } = xheaders ?? [];
|
||||
|
||||
public override readonly bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || obj is not PrmObjectSearch)
|
||||
return false;
|
||||
|
||||
return Equals((PrmObjectSearch)obj);
|
||||
}
|
||||
|
||||
public readonly bool Equals(PrmObjectSearch other)
|
||||
{
|
||||
return GetHashCode() == other.GetHashCode();
|
||||
}
|
||||
|
||||
public override readonly int GetHashCode()
|
||||
{
|
||||
return ContainerId.GetHashCode()
|
||||
^ Filters.GetHashCode()
|
||||
^ (SessionToken == null ? 0 : SessionToken.GetHashCode())
|
||||
^ XHeaders.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(PrmObjectSearch left, PrmObjectSearch right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(PrmObjectSearch left, PrmObjectSearch right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue