[#39] Client: add memory usage optimizations

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2025-03-07 15:29:45 +03:00
parent d6fe034453
commit 32a7e64538
14 changed files with 120 additions and 92 deletions

View file

@ -4,7 +4,9 @@ namespace FrostFS.SDK;
public class FrostFsObject
{
private byte[]? bytes;
// private byte[]? _payloadBytes;
// private ReadOnlyMemory<byte> _payloadMemory;
// private bool _isInitPayloadMemory;
/// <summary>
/// Creates new instance from <c>ObjectHeader</c>
@ -45,21 +47,31 @@ public class FrostFsObject
/// <value>Reader for received data</value>
public IObjectReader? ObjectReader { get; set; }
public byte[] SingleObjectPayload
{
get { return bytes ?? []; }
set { bytes = value; }
}
public ReadOnlyMemory<byte> SingleObjectPayload { get; set; }
//public ReadOnlyMemory<byte> SingleObjectPayloadMemory
//{
// get
// {
// if (!_isInitPayloadMemory)
// {
// _payloadMemory = _payloadBytes.AsMemory();
// _isInitPayloadMemory = true;
// }
// return _payloadMemory;
// }
// set
// {
// _payloadMemory = value;
// _isInitPayloadMemory = true;
// }
//}
/// <summary>
/// The size of payload cannot exceed <c>MaxObjectSize</c> value from <c>NetworkSettings</c>
/// Used only for PutSingleObject method
/// Provide SHA256 hash of the payload. If null, the hash is calculated by internal logic
/// </summary>
/// <value>Buffer for output data</value>
public void SetSingleObjectPayload(byte[] bytes)
{
this.bytes = bytes;
}
public byte[]? PayloadHash { get; set; }
/// <summary>
/// Applied only for the last Object in chain in case of manual multipart uploading