[#13] Change GetObject result to stream #12

Merged
PavelGrossSpb merged 3 commits from PavelGrossSpb/frostfs-sdk-csharp:ObjectDownloader into master 2024-09-04 19:51:24 +00:00
Showing only changes of commit 605463ec24 - Show all commits

View file

@ -310,7 +310,6 @@ internal class ObjectServiceProvider : ContextAccessor
return ObjectId.FromHash(response.Body.ObjectId.Value.ToByteArray());
}
// TODO: add implementation with stream writer!
private async Task<ModelsV2.Object> GetObject(GetRequest request, Context ctx)
{
var reader = GetObjectInit(request, ctx);
@ -321,28 +320,7 @@ internal class ObjectServiceProvider : ContextAccessor
@object.ObjectReader = reader;
return @object;
// obj.
// return obj.ToModel();
// var payload = new byte[obj.Header.PayloadLength];
// var offset = 0L;
// var chunk = await stream.ReadChunk();
// while (chunk is not null && (ulong)offset < obj.Header.PayloadLength)
// {
// var length = Math.Min((long)obj.Header.PayloadLength - offset, chunk.Length);
// Array.Copy(chunk, 0, payload, offset, length);
// offset += chunk.Length;
// chunk = await stream.ReadChunk();
// }
// obj.Payload = ByteString.CopyFrom(payload);
// return obj;
return @object;
}
private ObjectReader GetObjectInit(GetRequest initRequest, Context ctx)