Package tech.ydb.yoj.repository.ydb
Class YdbSpliterator<V>
java.lang.Object
tech.ydb.yoj.repository.ydb.YdbSpliterator<V>
- All Implemented Interfaces:
Spliterator<V>
YdbSpliterator used to read data from YDB streams.
It's possible to supply values from different threads, but supplier threads must not call onNext() concurrently.
This Spliterator should be explicitly closed by the close() method for finish work in YDB session; when the stream returned by
readTable() is used inside a YOJ transaction, close() will be called automatically at transaction end (both commit and rollback).
To use the new implementation, set ReadTableParams<...>.builder().<...>.useNewSpliterator(true).
Note that using the new implementation currently has a negative performance impact, for more information refer to GitHub Issue #42.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,T_CONS extends Object, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescriptionYdbSpliterator(String request, boolean isOrdered) protectedYdbSpliterator(String request, boolean isOrdered, Duration streamWorkTimeout) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()longlongvoidvoidonSupplierThreadComplete(tech.ydb.core.Status status, Throwable ex) booleantryAdvance(Consumer<? super V> action) trySplit()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, hasCharacteristics
-
Constructor Details
-
YdbSpliterator
-
YdbSpliterator
-
-
Method Details
-
createStream
-
onNext
-
onSupplierThreadComplete
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<V>
-
close
public void close() -
trySplit
- Specified by:
trySplitin interfaceSpliterator<V>
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<V>
-
getExactSizeIfKnown
public long getExactSizeIfKnown()- Specified by:
getExactSizeIfKnownin interfaceSpliterator<V>
-
characteristics
public int characteristics()- Specified by:
characteristicsin interfaceSpliterator<V>
-