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 call) : IDisposable { public AsyncServerStreamingCall Call { get; private set; } = call; public async Task?> 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(); } }