[#13] Client: Use code analyzers

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-09-23 18:53:21 +03:00
parent d7dbbf8da8
commit d1271df207
102 changed files with 2168 additions and 733 deletions

View file

@ -1,9 +1,11 @@
using System;
using FrostFS.SDK.ClientV2;
namespace FrostFS.SDK;
public class FrostFsObject
{
private byte[]? bytes;
/// <summary>
/// Creates new instance from <c>ObjectHeader</c>
/// </summary>
@ -37,19 +39,27 @@ public class FrostFsObject
get; set;
}
/// <summary>
/// The size of payload cannot exceed <c>MaxObjectSize</c> value from <c>NetworkSettings</c>
/// Used only for PutSingleObject method
/// </summary>
/// <value>Buffer for output data</value>
public byte[] Payload { get; set; } = [];
/// <summary>
/// A payload is obtained via stream reader
/// </summary>
/// <value>Reader for received data</value>
public IObjectReader? ObjectReader { get; set; }
internal byte[] SingleObjectPayload
{
get { return bytes ?? []; }
}
/// <summary>
/// The size of payload cannot exceed <c>MaxObjectSize</c> value from <c>NetworkSettings</c>
/// Used only for PutSingleObject method
/// </summary>
/// <value>Buffer for output data</value>
public void SetSingleObjectPayload(byte[] bytes)
{
this.bytes = bytes;
}
/// <summary>
/// Applied only for the last Object in chain in case of manual multipart uploading
/// </summary>
@ -57,7 +67,7 @@ public class FrostFsObject
public void SetParent(FrostFsObjectHeader largeObjectHeader)
{
if (Header?.Split == null)
throw new Exception("The object is not initialized properly");
throw new InvalidObjectException("The object is not initialized properly");
Header.Split.ParentHeader = largeObjectHeader;
}