Package org.apache.cassandra.io.tries
Class ValueIterator<CONCRETE extends ValueIterator<CONCRETE>>
- java.lang.Object
-
- org.apache.cassandra.io.tries.Walker<CONCRETE>
-
- org.apache.cassandra.io.tries.ValueIterator<CONCRETE>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
PartitionIndex.IndexPosIterator
@NotThreadSafe public class ValueIterator<CONCRETE extends ValueIterator<CONCRETE>> extends Walker<CONCRETE>
Thread-unsafe value iterator for on-disk tries. Uses the assumptions ofWalker
.The main utility of this class is the
nextPayloadedNode()
method, which lists all nodes that contain a payload within the requested bounds. The treatment of the bounds is non-standard (seeValueIterator(Rebufferer, long, ByteComparable, ByteComparable, boolean)
), necessary to properly walk tries of prefixes and separators.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValueIterator.IterationPosition
-
Nested classes/interfaces inherited from class org.apache.cassandra.io.tries.Walker
Walker.Extractor<RESULT,VALUE>, Walker.PayloadToString, Walker.TransitionBytesCollector
-
-
Field Summary
Fields Modifier and Type Field Description protected ValueIterator.IterationPosition
stack
-
Fields inherited from class org.apache.cassandra.io.tries.Walker
buf, BYTE_COMPARABLE_VERSION, greaterBranch, lesserBranch, nodeType, NONE, position, root
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueIterator(Rebufferer source, long root)
protected
ValueIterator(Rebufferer source, long root, boolean collecting)
protected
ValueIterator(Rebufferer source, long root, ByteComparable start, ByteComparable end, boolean admitPrefix)
protected
ValueIterator(Rebufferer source, long root, ByteComparable start, ByteComparable end, boolean admitPrefix, boolean collecting)
Constrained iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
advanceNode()
protected ByteComparable
nextCollectedValue()
protected long
nextPayloadedNode()
Returns the position of the next node with payload contained in the iterated span.protected long
peekNode()
Returns the payload node position without advancing.-
Methods inherited from class org.apache.cassandra.io.tries.Walker
close, dumpTrie, follow, followWithGreater, followWithLesser, getMaxTerm, getMinTerm, go, goMax, goMin, greaterTransition, hasChildren, hasPayload, lastTransition, lesserTransition, nodeSize, nodeTypeOrdinal, payloadFlags, payloadPosition, prefix, prefixAndNeighbours, search, toString, transition, transitionByte, transitionRange
-
-
-
-
Field Detail
-
stack
protected ValueIterator.IterationPosition stack
-
-
Constructor Detail
-
ValueIterator
protected ValueIterator(Rebufferer source, long root)
-
ValueIterator
protected ValueIterator(Rebufferer source, long root, boolean collecting)
-
ValueIterator
protected ValueIterator(Rebufferer source, long root, ByteComparable start, ByteComparable end, boolean admitPrefix)
-
ValueIterator
protected ValueIterator(Rebufferer source, long root, ByteComparable start, ByteComparable end, boolean admitPrefix, boolean collecting)
Constrained iterator. The end position is always treated as inclusive, and we have two possible treatments for the start:- When
admitPrefix=false
, exact matches and any prefixes of the start are excluded. - When
admitPrefix=true
, the longest prefix of the start present in the trie is also included, provided that there is no entry in the trie between that prefix and the start. An exact match also satisfies this and is included.
ReverseValueIterator
. - When
-
-
Method Detail
-
peekNode
protected long peekNode()
Returns the payload node position without advancing.
-
nextPayloadedNode
protected long nextPayloadedNode()
Returns the position of the next node with payload contained in the iterated span.
-
nextCollectedValue
protected ByteComparable nextCollectedValue()
-
advanceNode
protected long advanceNode()
-
-