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:
AutoCloseable,IncrementalTrieWriter<VALUE>
@NotThreadSafe
public class IncrementalDeepTrieWriterPageAware<VALUE>
extends IncrementalTrieWriterPageAware<VALUE>
This class is a variant of
IncrementalTrieWriterPageAware 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
ConstructorsConstructorDescriptionIncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest) IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest, int maxRecursionDepth) -
Method Summary
Modifier and TypeMethodDescriptionprotected intrecalcTotalSize(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, long nodePosition) protected longprotected longwritePartial(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, resetMethods inherited from class org.apache.cassandra.io.tries.IncrementalTrieWriterBase
add, close, complete, completeLast, count, resetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.tries.IncrementalTrieWriter
add, close, complete, count
-
Constructor Details
-
IncrementalDeepTrieWriterPageAware
public IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest, int maxRecursionDepth) -
IncrementalDeepTrieWriterPageAware
public IncrementalDeepTrieWriterPageAware(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
-
-
Method Details
-
recalcTotalSize
protected int recalcTotalSize(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, long nodePosition) throws IOException - Overrides:
recalcTotalSizein classIncrementalTrieWriterPageAware<VALUE>- Throws:
IOException
-
write
protected long write(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node) throws IOException - Overrides:
writein classIncrementalTrieWriterPageAware<VALUE>- Throws:
IOException
-
writePartial
protected long writePartial(org.apache.cassandra.io.tries.IncrementalTrieWriterPageAware.Node<VALUE> node, DataOutputPlus dest, long baseOffset) throws IOException - Overrides:
writePartialin classIncrementalTrieWriterPageAware<VALUE>- Throws:
IOException
-