34 lines
No EOL
804 B
C#
34 lines
No EOL
804 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
using FrostFS.Object;
|
|
using FrostFS.Refs;
|
|
|
|
using Google.Protobuf.Collections;
|
|
|
|
using Grpc.Core;
|
|
|
|
namespace FrostFS.SDK.Client;
|
|
|
|
internal sealed class SearchReader(AsyncServerStreamingCall<SearchResponse> call) : IDisposable
|
|
{
|
|
internal AsyncServerStreamingCall<SearchResponse> Call { get; private set; } = call;
|
|
|
|
internal async Task<RepeatedField<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;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Call?.Dispose();
|
|
}
|
|
} |