Package org.apache.cassandra.io.tries
Class IncrementalTrieWriterBase<VALUE,DEST,NODE extends org.apache.cassandra.io.tries.IncrementalTrieWriterBase.BaseNode<VALUE,NODE>>
- java.lang.Object
-
- org.apache.cassandra.io.tries.IncrementalTrieWriterBase<VALUE,DEST,NODE>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,IncrementalTrieWriter<VALUE>
- Direct Known Subclasses:
IncrementalTrieWriterPageAware
,IncrementalTrieWriterSimple
public abstract class IncrementalTrieWriterBase<VALUE,DEST,NODE extends org.apache.cassandra.io.tries.IncrementalTrieWriterBase.BaseNode<VALUE,NODE>> extends java.lang.Object implements IncrementalTrieWriter<VALUE>
Helper base class for incremental trie builders.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.io.tries.IncrementalTrieWriter
IncrementalTrieWriter.PartialTail
-
-
Field Summary
Fields Modifier and Type Field Description protected DEST
dest
protected ByteComparable
prev
protected TrieSerializer<VALUE,? super DEST>
serializer
protected java.util.Deque<NODE>
stack
-
Constructor Summary
Constructors Modifier Constructor Description protected
IncrementalTrieWriterBase(TrieSerializer<VALUE,? super DEST> serializer, DEST dest, NODE root)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(ByteComparable next, VALUE value)
Add an entry to the trie with the associated value.void
close()
long
complete()
Complete the process and return the position in the file of the root node.protected NODE
completeLast()
long
count()
Return the number of added entries.abstract IncrementalTrieWriter.PartialTail
makePartialRoot()
Make a temporary in-memory representation of the unwritten nodes that covers everything added to the trie until this point.protected void
reset(NODE root)
-
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
reset
-
-
-
-
Field Detail
-
stack
protected final java.util.Deque<NODE extends org.apache.cassandra.io.tries.IncrementalTrieWriterBase.BaseNode<VALUE,NODE>> stack
-
serializer
protected final TrieSerializer<VALUE,? super DEST> serializer
-
dest
protected final DEST dest
-
prev
protected ByteComparable prev
-
-
Constructor Detail
-
IncrementalTrieWriterBase
protected IncrementalTrieWriterBase(TrieSerializer<VALUE,? super DEST> serializer, DEST dest, NODE root)
-
-
Method Detail
-
reset
protected void reset(NODE root)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceIncrementalTrieWriter<VALUE>
-
add
public void add(ByteComparable next, VALUE value) throws java.io.IOException
Description copied from interface:IncrementalTrieWriter
Add an entry to the trie with the associated value.- Specified by:
add
in interfaceIncrementalTrieWriter<VALUE>
- Throws:
java.io.IOException
-
complete
public long complete() throws java.io.IOException
Description copied from interface:IncrementalTrieWriter
Complete the process and return the position in the file of the root node.- Specified by:
complete
in interfaceIncrementalTrieWriter<VALUE>
- Throws:
java.io.IOException
-
count
public long count()
Description copied from interface:IncrementalTrieWriter
Return the number of added entries.- Specified by:
count
in interfaceIncrementalTrieWriter<VALUE>
-
completeLast
protected NODE completeLast() throws java.io.IOException
- Throws:
java.io.IOException
-
makePartialRoot
public abstract 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>
- Throws:
java.io.IOException
-
-