frostfs-sdk-csharp/src/FrostFS.SDK.ClientV2/Tools/SearchReader.cs
Pavel Gross 7b9c19f37c
All checks were successful
DCO / DCO (pull_request) Successful in 47s
[#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>
2024-07-18 15:33:40 +03:00

34 lines
No EOL
804 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Grpc.Core;
using FrostFS.Object;
using FrostFS.Refs;
using System.Threading;
namespace FrostFS.SDK.ClientV2;
internal class SearchReader(AsyncServerStreamingCall<SearchResponse> call) : IDisposable
{
public AsyncServerStreamingCall<SearchResponse> Call { get; private set; } = call;
public async Task<List<ObjectID>?> Read(CancellationToken cancellationToken)
{
if (!await Call.ResponseStream.MoveNext(cancellationToken))
return null;
var response = Call.ResponseStream.Current;
Verifier.CheckResponse(response);
return response.Body?.IdList.ToList();
}
public void Dispose()
{
Call.Dispose();
}
}