Package org.apache.cassandra.io.tries
Class IncrementalDeepTrieWriterPageAware<VALUE>
- java.lang.Object
-
- org.apache.cassandra.io.tries.IncrementalTrieWriterBase<VALUE,DataOutputPlus,org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE>>
-
- org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware<VALUE>
-
- org.apache.cassandra.io.tries.IncrementalDeepTrieWriterPageAware<VALUE>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,IncrementalTrieWriter<VALUE>
@NotThreadSafe public class IncrementalDeepTrieWriterPageAware<VALUE> extends IncrementalTrieWriterPageAware<VALUE>
This class is a variant ofIncrementalTrieWriterPageAware
which is able to build even very deep tries. While the parent class uses recursion for clarity, it may end up with stack overflow for tries with very long keys. This implementation can switch processing from stack to heap at a certain depth (provided as a constructor param).This class intentionally repeats code present in the parent class, both in the in-stack and on-heap versions of each of the three implemented recursive operations. Removing this repetition can cause higher stack usage and thus stack overflow failures.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.io.tries.IncrementalTrieWriter
IncrementalTrieWriter.PartialTail
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.tries.IncrementalTrieWriterBase
dest, prev, serializer, stack
-
-
Constructor Summary
Constructors Constructor Description IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest, int maxRecursionDepth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
recalcTotalSize(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, long nodePosition)
protected long
write(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node)
protected long
writePartial(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, DataOutputPlus dest, long baseOffset)
-
Methods inherited from class org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware
dumpNode, makePartialRoot, reset
-
Methods inherited from class org.apache.cassandra.io.tries.IncrementalTrieWriterBase
add, close, complete, completeLast, count, reset
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.io.tries.IncrementalTrieWriter
add, close, complete, count
-
-
-
-
Constructor Detail
-
IncrementalDeepTrieWriterPageAware
public IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest, int maxRecursionDepth)
-
IncrementalDeepTrieWriterPageAware
public IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
-
-
Method Detail
-
recalcTotalSize
protected int recalcTotalSize(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, long nodePosition) throws java.io.IOException
- Overrides:
recalcTotalSize
in classIncrementalTrieWriterPageAware<VALUE>
- Throws:
java.io.IOException
-
write
protected long write(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node) throws java.io.IOException
- Overrides:
write
in classIncrementalTrieWriterPageAware<VALUE>
- Throws:
java.io.IOException
-
writePartial
protected long writePartial(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, DataOutputPlus dest, long baseOffset) throws java.io.IOException
- Overrides:
writePartial
in classIncrementalTrieWriterPageAware<VALUE>
- Throws:
java.io.IOException
-
-