[#17] Client: Add extra parameter
API methods' parameters types with optional session, polling settings, xHeaders etc. and corresponding handlers have been added Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
00a1e9412f
commit
7b9c19f37c
42 changed files with 1054 additions and 386 deletions
|
@ -6,32 +6,56 @@ namespace FrostFS.SDK.ModelsV2;
|
|||
|
||||
public class FrostFsObject
|
||||
{
|
||||
public FrostFsObject(ObjectId objectId, ObjectHeader header, byte[] payload)
|
||||
/// <summary>
|
||||
/// Creates new instance from <c>ObjectHeader</c>
|
||||
/// </summary>
|
||||
/// <param name="header"></param> <summary>
|
||||
public FrostFsObject(ObjectHeader header)
|
||||
{
|
||||
ObjectId = objectId;
|
||||
Payload = payload;
|
||||
Header = header;
|
||||
}
|
||||
|
||||
public FrostFsObject(ContainerId container, byte[] payload, ObjectType objectType = ObjectType.Regular)
|
||||
/// <summary>
|
||||
/// Creates new instance with specified parameters
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="objectType"></param>
|
||||
public FrostFsObject(ContainerId container, ObjectType objectType = ObjectType.Regular)
|
||||
{
|
||||
Payload = payload;
|
||||
Header = new ObjectHeader(containerId: container, type: objectType, attributes: []);
|
||||
Header = new ObjectHeader(containerId: container, type: objectType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Header contains metadata for the object
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public ObjectHeader Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value is calculated internally as a hash of ObjectHeader. Do not use pre-calculated value is the object has been changed.
|
||||
/// </summary>
|
||||
public ObjectId? ObjectId
|
||||
{
|
||||
get; internal set;
|
||||
}
|
||||
|
||||
public byte[] Payload { 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; }
|
||||
|
||||
public Signature? Signature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Applied only for the last Object in chain in case of manual multipart uploading
|
||||
/// </summary>
|
||||
/// <param name="largeObject">Parent for multipart object</param>
|
||||
public void SetParent(LargeObject largeObject)
|
||||
{
|
||||
if (Header?.Split == null)
|
||||
|
@ -41,7 +65,7 @@ public class FrostFsObject
|
|||
}
|
||||
}
|
||||
|
||||
public class LargeObject(ContainerId container) : FrostFsObject(container, [])
|
||||
public class LargeObject(ContainerId container) : FrostFsObject(container)
|
||||
{
|
||||
private readonly SHA256 payloadHash = SHA256.Create();
|
||||
|
||||
|
@ -66,11 +90,11 @@ public class LargeObject(ContainerId container) : FrostFsObject(container, [])
|
|||
|
||||
public class LinkObject : FrostFsObject
|
||||
{
|
||||
public LinkObject(ContainerId containerId, SplitId splitId, LargeObject largeObject) : base (containerId, [])
|
||||
public LinkObject(ContainerId containerId, SplitId splitId, LargeObject largeObject) : base (containerId)
|
||||
{
|
||||
Header!.Split = new Split(splitId)
|
||||
{
|
||||
ParentHeader = largeObject.Header
|
||||
ParentHeader = largeObject.Header
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue