using System; namespace FrostFS.SDK; public class FrostFsObject { // private byte[]? _payloadBytes; // private ReadOnlyMemory _payloadMemory; // private bool _isInitPayloadMemory; /// /// Creates new instance from ObjectHeader /// /// public FrostFsObject(FrostFsObjectHeader header) { Header = header; } /// /// Creates new instance with specified parameters /// /// /// public FrostFsObject(FrostFsContainerId container, FrostFsObjectType objectType = FrostFsObjectType.Regular) { Header = new FrostFsObjectHeader(containerId: container, type: objectType); } /// /// Header contains metadata for the object /// /// public FrostFsObjectHeader Header { get; set; } /// /// The value is calculated internally as a hash of ObjectHeader. Do not use pre-calculated value is the object has been changed. /// public FrostFsObjectId? ObjectId { get; set; } /// /// A payload is obtained via stream reader /// /// Reader for received data public IObjectReader? ObjectReader { get; set; } public ReadOnlyMemory SingleObjectPayload { get; set; } //public ReadOnlyMemory SingleObjectPayloadMemory //{ // get // { // if (!_isInitPayloadMemory) // { // _payloadMemory = _payloadBytes.AsMemory(); // _isInitPayloadMemory = true; // } // return _payloadMemory; // } // set // { // _payloadMemory = value; // _isInitPayloadMemory = true; // } //} /// /// Provide SHA256 hash of the payload. If null, the hash is calculated by internal logic /// public byte[]? PayloadHash { get; set; } /// /// Applied only for the last Object in chain in case of manual multipart uploading /// /// Parent for multipart object public void SetParent(FrostFsObjectHeader largeObjectHeader) { if (Header?.Split == null) throw new ArgumentNullException(nameof(largeObjectHeader), "Split value must not be null"); Header.Split.ParentHeader = largeObjectHeader; } }