44
55namespace Vibrant . InfluxDB . Client . Helpers
66{
7- internal enum AllowedCalls
8- {
9- ConsumeNextResultAsync = 0b001 ,
10- ConsumeNextSerieAsync = 0b010 ,
11- GetNextBatchAsync = 0b100
12- }
13-
147 internal class ContextualQueryResultIterator < TInfluxRow > : IDisposable
158 where TInfluxRow : new ( )
169 {
@@ -21,18 +14,13 @@ internal class ContextualQueryResultIterator<TInfluxRow> : IDisposable
2114 private int ? _currentStatementId ;
2215 private bool _consumeCurrentResultNextTime ;
2316
24- //private bool? _consumedNextResult_Result;
25-
2617 private InfluxSeries < TInfluxRow > _currentSerie ;
2718 private InfluxSeries < TInfluxRow > _capturedSerie ;
2819 private IReadOnlyDictionary < string , object > _currentTags ;
2920 private bool _consumeCurrentSerieNextTime ;
3021
31- //private bool? _consumedNextSerie_Result;
32-
3322 private List < TInfluxRow > _currentBatch ;
3423 private List < TInfluxRow > _capturedBatch ;
35- //private bool _hasConsumedCurrentBatch = true;
3624
3725 private bool _disposed = false ;
3826
@@ -215,111 +203,6 @@ public async Task<bool> ConsumeNextBatchAsync()
215203 }
216204 }
217205
218-
219-
220- //public async Task<bool> ConsumeNextResultAsync()
221- //{
222- // // throw invalid operation if not called correctly!
223-
224- // if( _consumedNextResult_Result.HasValue )
225- // {
226- // var resultOfPreviousCall = _consumedNextResult_Result.Value;
227- // _consumedNextResult_Result = null;
228- // return resultOfPreviousCall;
229- // }
230-
231- // bool hasMore = await _resultIterator.ConsumeNextResultAsync().ConfigureAwait( false );
232- // if( !hasMore )
233- // {
234- // _currentResult = null;
235- // return false;
236- // }
237-
238- // _currentResult = _resultIterator.CurrentResult;
239- // return true;
240- //}
241-
242-
243- //public async Task<bool> ConsumeNextSerieAsync()
244- //{
245- // // throw invalid operation if not called correctly!
246-
247- // if( _consumedNextSerie_Result.HasValue )
248- // {
249- // var resultOfPreviousCall = _consumedNextSerie_Result.Value;
250- // _consumedNextSerie_Result = null;
251- // return resultOfPreviousCall;
252- // }
253-
254- // bool hasMore = await _resultIterator.ConsumeNextSerieAsync().ConfigureAwait( false );
255- // if( !hasMore ) // 'next' serie might be in next result, which means we should still return true
256- // {
257- // // in which case we might consume a result, we might not use here
258- // _consumedNextResult_Result = await _resultIterator.ConsumeNextResultAsync().ConfigureAwait( false );
259- // if( _consumedNextResult_Result == true )
260- // {
261- // var previousResult = _currentResult;
262- // _currentResult = _resultIterator.CurrentResult;
263-
264- // if( previousResult.StatementId == _currentResult.StatementId )
265- // {
266- // hasMore = await _resultIterator.ConsumeNextSerieAsync().ConfigureAwait( false );
267- // if( hasMore )
268- // {
269- // _currentSerie = _resultIterator.CurrentSerie;
270- // return true;
271- // }
272-
273- // _consumedNextResult_Result = null; // still the same statement, so we consumed it
274- // }
275- // }
276- // else
277- // {
278- // _currentResult = null;
279- // }
280-
281- // _currentSerie = null;
282- // return false;
283- // }
284-
285- // _currentSerie = _resultIterator.CurrentSerie;
286- // return true;
287- //}
288-
289- //public async Task<List<TInfluxRow>> GetNextBatchAsync()
290- //{
291- // // throw invalid operation if not called correctly!
292-
293- // if( hasConsumedCurrentBatch )
294- // {
295- // var previousSerie = _currentSerie;
296- // _consumedNextSerie_Result = await ConsumeNextSerieAsync().ConfigureAwait( false );
297- // if( !_consumedNextSerie_Result.Value )
298- // {
299- // hasConsumedCurrentBatch = false;
300- // return null;
301- // }
302-
303- // if( previousSerie == null || InfluxSeriesComparer.Compare( previousSerie, _currentSerie ) )
304- // {
305- // _consumedNextSerie_Result = null;
306- // hasConsumedCurrentBatch = true;
307- // return _currentSerie.Rows;
308- // }
309-
310- // // might return null
311- // hasConsumedCurrentBatch = false;
312- // return null;
313- // }
314- // else
315- // {
316- // hasConsumedCurrentBatch = true;
317- // return _currentSerie.Rows;
318- // }
319-
320- // // need to consume to next serie, and check if it is the same serie in the same statement(?)
321- //}
322-
323206 public InfluxResult < TInfluxRow > CurrentResult
324207 {
325208 get
0 commit comments