[#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
2 changed files with 6 additions and 4 deletions
Showing only changes of commit 17492ee871 - Show all commits

View file

@ -5,6 +5,7 @@ using Grpc.Core;
using FrostFS.Object;
using FrostFS.SDK.ModelsV2;
using System.Threading;
namespace FrostFS.SDK.ClientV2;
@ -32,9 +33,9 @@ public class ObjectReader(AsyncServerStreamingCall<GetResponse> call) : IObjectR
};
}
public async Task<byte[]?> ReadChunk()
public async Task<byte[]?> ReadChunk(CancellationToken cancellationToken = default)
{
if (!await Call.ResponseStream.MoveNext())
if (!await Call.ResponseStream.MoveNext(cancellationToken))
return null;
var response = Call.ResponseStream.Current;

View file

@ -1,9 +1,10 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace FrostFS.SDK.ModelsV2;
public interface IObjectReader : IDisposable
{
Task<byte[]?> ReadChunk();
Task<byte[]?> ReadChunk(CancellationToken cancellationToken = default);
}