using System.IO; namespace FrostFS.SDK.Client; public readonly struct PrmObjectPatch( FrostFsAddress address, FrostFsRange range, Stream? payload, int maxChunkLength, FrostFsSessionToken? sessionToken = null, bool replaceAttributes = false, FrostFsAttributePair[]? newAttributes = null, string[]? xheaders = null) : ISessionToken, System.IEquatable { public FrostFsAddress Address { get; } = address; public FrostFsRange Range { get; } = range; /// /// A stream with source data /// public Stream? Payload { get; } = payload; public FrostFsAttributePair[]? NewAttributes { get; } = newAttributes; public bool ReplaceAttributes { get; } = replaceAttributes; public int MaxChunkLength { get; } = maxChunkLength; /// public FrostFsSessionToken? SessionToken { get; } = sessionToken; /// /// FrostFS request X-Headers /// public string[] XHeaders { get; } = xheaders ?? []; public override readonly bool Equals(object obj) { if (obj == null || obj is not PrmObjectPatch) return false; return Equals((PrmObjectPatch)obj); } public readonly bool Equals(PrmObjectPatch other) { return GetHashCode() == other.GetHashCode(); } public override readonly int GetHashCode() { return Address.GetHashCode() ^ Range.GetHashCode() ^ (Payload == null ? 0 : Payload.GetHashCode()) ^ (NewAttributes == null ? 0 : NewAttributes.GetHashCode()) ^ (SessionToken == null ? 0 : SessionToken.GetHashCode()) ^ (ReplaceAttributes ? 1 : 0) ^ MaxChunkLength; } public static bool operator ==(PrmObjectPatch left, PrmObjectPatch right) { return left.Equals(right); } public static bool operator !=(PrmObjectPatch left, PrmObjectPatch right) { return !(left == right); } }