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:
java.lang.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
Constructors Constructor Description IncrementalTrieWriterSimple(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
complete(org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE> node)
IncrementalTrieWriter.PartialTail
makePartialRoot()
Make a temporary in-memory representation of the unwritten nodes that covers everything added to the trie until this point.void
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
-
IncrementalTrieWriterSimple
public IncrementalTrieWriterSimple(TrieSerializer<VALUE,? super DataOutputPlus> trieSerializer, DataOutputPlus dest)
-
-
Method Detail
-
complete
protected void complete(org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE> node) throws java.io.IOException
- Throws:
java.io.IOException
-
reset
public void reset()
- Specified by:
reset
in interfaceIncrementalTrieWriter<VALUE>
-
makePartialRoot
public IncrementalTrieWriter.PartialTail makePartialRoot() throws java.io.IOException
Description copied from interface:IncrementalTrieWriter
Make 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:
makePartialRoot
in interfaceIncrementalTrieWriter<VALUE>
- Specified by:
makePartialRoot
in classIncrementalTrieWriterBase<VALUE,DataOutputPlus,org.apache.cassandra.io.tries.IncrementalTrieWriterSimple.Node<VALUE>>
- Throws:
java.io.IOException
-
-