public bool MoveNext() { bool hasNext = false; while ((currentEnumerator == null || !(hasNext = nextCondition(currentEnumerator)) || !currentSegment.IsOpen) && index < segmentsEnumerator.Count) { CloseCurrentEnumerator(); currentSegment = segmentsEnumerator[index]; ++index; try { if (from == null || to == null) { currentEnumerator = forward ? currentSegment.All().ToWrap() : currentSegment.ReverseAll().ToWrap(); } else { currentEnumerator = forward ? currentSegment.Range(from, to) : currentSegment.ReverseRange(from, to); } } catch (InvalidStateStoreException) { // segment may have been close, ignore, next segment currentEnumerator = null; } } return(currentEnumerator != null && hasNext); }
public CompositeKeyValueEnumerator( IEnumerable <S> storeEnumerable, Func <S, IKeyValueEnumerator <K, V> > nextIterator) { storeIterator = new List <S>(storeEnumerable); this.nextIterator = nextIterator; current = null; }
public bool MoveNext() { while ((current == null || !current.MoveNext()) && index < storeIterator.Count) { CloseCurrentEnumerator(); current = nextIterator?.Invoke(storeIterator[index]); ++index; } return(current != null && current.Current.HasValue); }
public MeteredWindowedKeyValueEnumerator( IKeyValueEnumerator <Windowed <Bytes>, byte[]> keyValueEnumerator, Func <byte[], K> funcSerdesKey, Func <byte[], V> funcSerdesValue, Sensor sensor) { innerEnumerator = keyValueEnumerator; this.funcSerdesKey = funcSerdesKey; this.funcSerdesValue = funcSerdesValue; this.sensor = sensor; startMs = DateTime.Now.GetMilliseconds(); }
public MeteredKeyValueEnumerator( IKeyValueEnumerator <Bytes, byte[]> innerEnumerator, Sensor sensor, Func <byte[], K> funcSerdesKey, Func <byte[], V> funcSerdesValue) { this.innerEnumerator = innerEnumerator; this.sensor = sensor; this.funcSerdesKey = funcSerdesKey; this.funcSerdesValue = funcSerdesValue; startMs = DateTime.Now.GetMilliseconds(); }
/// <summary> /// Creates a <see cref="List{KeyValuePair}"/> from an <see cref="IKeyValueEnumerator{K, V}"/> /// </summary> /// <typeparam name="K">Key type</typeparam> /// <typeparam name="V">Value type</typeparam> /// <param name="enumerator"><see cref="IKeyValueEnumerator{K, V}"/> enumerator</param> /// <returns>Return an instance of <see cref="List{KeyValuePair}"/></returns> public static List <KeyValuePair <K, V> > ToList <K, V>(this IKeyValueEnumerator <K, V> enumerator) { List <KeyValuePair <K, V> > list = new List <KeyValuePair <K, V> >(); while (enumerator.MoveNext()) { if (enumerator.Current.HasValue) { list.Add(enumerator.Current.Value); } } enumerator.Dispose(); return(list); }
private void CloseCurrentEnumerator() { current?.Dispose(); current = null; }
public RocksDbEnumerable(string stateStoreName, IKeyValueEnumerator <Bytes, byte[]> enumerator) { this.stateStoreName = stateStoreName; this.enumerator = enumerator; }
public static IKeyValueEnumerator <K1, V1> Transform <K, V, K1, V1>(this IKeyValueEnumerator <K, V> enumerator, Func <K, V, KeyValuePair <K1, V1> > function) => new TransformKeyValueEnumerator <K, V, K1, V1>(enumerator, function);
public KeyValueEnumeratorFacade(IKeyValueEnumerator <Windowed <K>, ValueAndTimestamp <V> > keyValueEnumerator) { this.keyValueEnumerator = keyValueEnumerator; }
public TransformKeyValueEnumerator(IKeyValueEnumerator <K, V> enumerator, Func <K, V, KeyValuePair <K1, V1> > function) { this.enumerator = enumerator; this.function = function; }
public WindowedKeyValueEnumerator(IKeyValueEnumerator <Windowed <Bytes>, byte[]> keyValueEnumerator, ISerDes <K> keySerdes, ISerDes <V> valueSerdes) { innerEnumerator = keyValueEnumerator; this.keySerdes = keySerdes; this.valueSerdes = valueSerdes; }
public WrappedRocksRbKeyValueEnumerator(IKeyValueEnumerator <Bytes, byte[]> enumerator, Func <WrappedRocksRbKeyValueEnumerator, bool> closingCallback) { this.wrapped = enumerator; this.closingCallback = closingCallback; }
public InMemoryKeyValueEnumerator(IEnumerable <KeyValuePair <Bytes, byte[]> > values, bool forward) { enumerator = forward ? values.ToWrap() : values.Reverse().ToWrap(); }
public WrappedKeyValueEnumerator(IKeyValueEnumerator <Bytes, byte[]> bytesEnumerator, long windowSize) { this.bytesEnumerator = bytesEnumerator; this.windowSize = windowSize; }
public WrappedWindowStoreEnumerator(IKeyValueEnumerator <Bytes, byte[]> bytesEnumerator) { this.bytesEnumerator = bytesEnumerator; }
internal WindowStoreEnumeratorWrapper(IKeyValueEnumerator <Bytes, byte[]> bytesEnumerator, long windowSize) { this.bytesEnumerator = bytesEnumerator; this.windowSize = windowSize; }