All checks were successful
DCO / DCO (pull_request) Successful in 35s
Signed-off-by: Pavel Gross <p.gross@yadro.com>
34 lines
No EOL
819 B
C#
34 lines
No EOL
819 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
using FrostFS.Object;
|
|
using FrostFS.Refs;
|
|
|
|
using Grpc.Core;
|
|
|
|
namespace FrostFS.SDK.ClientV2;
|
|
|
|
internal sealed 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).ConfigureAwait(false))
|
|
return null;
|
|
|
|
var response = Call.ResponseStream.Current;
|
|
|
|
Verifier.CheckResponse(response);
|
|
|
|
return response.Body?.IdList.ToList();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Call?.Dispose();
|
|
}
|
|
} |