All checks were successful
lint-build / dotnet8.0 (push) Successful in 39s
Signed-off-by: Pavel Gross <p.gross@yadro.com>
81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using System.IO;
|
|
|
|
namespace FrostFS.SDK.Client;
|
|
|
|
public readonly struct PrmObjectClientCutPut(
|
|
FrostFsObjectHeader? header,
|
|
Stream? payload,
|
|
int bufferMaxSize = 0,
|
|
FrostFsSessionToken? sessionToken = null,
|
|
byte[]? customBuffer = null,
|
|
string[]? xheaders = null,
|
|
UploadProgressInfo? progress = null) : PrmObjectPutBase, System.IEquatable<PrmObjectClientCutPut>
|
|
{
|
|
/// <summary>
|
|
/// Need to provide values like <c>ContainerId</c> and <c>ObjectType</c> to create and object.
|
|
/// Optional parameters ike <c>Attributes</c> can be provided as well.
|
|
/// </summary>
|
|
/// <value>Header with required parameters to create an object</value>
|
|
public FrostFsObjectHeader? Header { get; } = header;
|
|
|
|
/// <summary>
|
|
/// A stream with source data
|
|
/// </summary>
|
|
public Stream? Payload { get; } = payload;
|
|
|
|
/// <summary>
|
|
/// Overrides default size of the buffer for stream transferring.
|
|
/// </summary>
|
|
/// <value>Size of the buffer</value>
|
|
public int BufferMaxSize { get; } = bufferMaxSize;
|
|
|
|
/// <summary>
|
|
/// Allows to define a buffer for chunks to manage by the memory allocation and releasing.
|
|
/// </summary>
|
|
public byte[]? CustomBuffer { get; } = customBuffer;
|
|
|
|
/// <inheritdoc />
|
|
public FrostFsSessionToken? SessionToken { get; } = sessionToken;
|
|
|
|
/// <summary>
|
|
/// FrostFS request X-Headers
|
|
/// </summary>
|
|
public string[] XHeaders { get; } = xheaders ?? [];
|
|
|
|
public UploadProgressInfo? Progress { get; } = progress;
|
|
|
|
internal PutObjectContext PutObjectContext { get; } = new();
|
|
|
|
public override readonly bool Equals(object obj)
|
|
{
|
|
if (obj == null || obj is not PrmObjectClientCutPut)
|
|
return false;
|
|
|
|
return Equals((PrmObjectClientCutPut)obj);
|
|
}
|
|
|
|
public readonly bool Equals(PrmObjectClientCutPut other)
|
|
{
|
|
return GetHashCode() == other.GetHashCode();
|
|
}
|
|
|
|
public override readonly int GetHashCode()
|
|
{
|
|
return BufferMaxSize
|
|
^ (Header == null ? 0 : Header.GetHashCode())
|
|
^ (Payload == null ? 0 : Payload.GetHashCode())
|
|
^ (CustomBuffer == null ? 0 : CustomBuffer.GetHashCode())
|
|
^ (SessionToken == null ? 0 : SessionToken.GetHashCode())
|
|
^ XHeaders.GetHashCode();
|
|
}
|
|
|
|
public static bool operator ==(PrmObjectClientCutPut left, PrmObjectClientCutPut right)
|
|
{
|
|
return left.Equals(right);
|
|
}
|
|
|
|
public static bool operator !=(PrmObjectClientCutPut left, PrmObjectClientCutPut right)
|
|
{
|
|
return !(left == right);
|
|
}
|
|
}
|