Package org.apache.cassandra.io.tries
Class IncrementalTrieWriterSimple<VALUE>
java.lang.Object
org.apache.cassandra.io.tries.IncrementalTrieWriterBase<VALUE,DataOutputPlus,org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE>>
org.apache.cassandra.io.tries.IncrementalTrieWriterSimple<VALUE>
- All Implemented Interfaces:
AutoCloseable,IncrementalTrieWriter<VALUE>
@NotThreadSafe
public class IncrementalTrieWriterSimple<VALUE>
extends IncrementalTrieWriterBase<VALUE,DataOutputPlus,org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE>>
implements IncrementalTrieWriter<VALUE>
Incremental builder of on-disk tries. Takes sorted input.
Incremental building is done by maintaining a stack of nodes in progress which follows the path to reach the last added entry. When a new entry is needed, comparison with the previous can tell us how much of the parents stack remains the same. The rest of the stack is complete as no new entry can affect them due to the input sorting. The completed nodes can be written to disk and discarded, keeping only a pointer to their location in the file (this pointer will be discarded too when the parent node is completed). This ensures that a very limited amount of data is kept in memory at all times.
Note: This class is currently unused (but tested) and stands only as form of documentation for
IncrementalTrieWriterPageAware.
-
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
ConstructorsConstructorDescriptionIncrementalTrieWriterSimple(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMake a temporary in-memory representation of the unwritten nodes that covers everything added to the trie until this point.voidreset()Methods 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
-
IncrementalTrieWriterSimple
public IncrementalTrieWriterSimple(TrieSerializer<VALUE, ? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
-
-
Method Details
-
complete
protected void complete(org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE> node) throws IOException - Throws:
IOException
-
reset
public void reset()- Specified by:
resetin interfaceIncrementalTrieWriter<VALUE>
-
makePartialRoot
Description copied from interface:IncrementalTrieWriterMake a temporary in-memory representation of the unwritten nodes that covers everything added to the trie until this point. The object returned represents a "tail" for the file that needs to be attached at the "cutoff" point to the file (using e.g. TailOverridingRebufferer).- Specified by:
makePartialRootin interfaceIncrementalTrieWriter<VALUE>- Specified by:
makePartialRootin classIncrementalTrieWriterBase<VALUE,DataOutputPlus, org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE>> - Throws:
IOException
-