Search in sources :

Example 6 with MappedBuffer

use of org.apache.cassandra.index.sasi.utils.MappedBuffer in project cassandra by apache.

the class TokenTreeTest method buildTree.

private static TokenTree buildTree(TokenTreeBuilder builder) throws Exception {
    builder.finish();
    final File treeFile = FileUtils.createTempFile("token-tree-", "db");
    treeFile.deleteOnExit();
    try (SequentialWriter writer = new SequentialWriter(treeFile, DEFAULT_OPT)) {
        builder.write(writer);
        writer.sync();
    }
    final RandomAccessReader reader = RandomAccessReader.open(treeFile);
    return new TokenTree(new MappedBuffer(reader));
}
Also used : RandomAccessReader(org.apache.cassandra.io.util.RandomAccessReader) SequentialWriter(org.apache.cassandra.io.util.SequentialWriter) File(org.apache.cassandra.io.util.File) MappedBuffer(org.apache.cassandra.index.sasi.utils.MappedBuffer)

Aggregations

MappedBuffer (org.apache.cassandra.index.sasi.utils.MappedBuffer)6 File (org.apache.cassandra.io.util.File)5 RandomAccessReader (org.apache.cassandra.io.util.RandomAccessReader)5 SequentialWriter (org.apache.cassandra.io.util.SequentialWriter)5 LongSet (com.carrotsearch.hppc.LongSet)2 LongHashSet (com.carrotsearch.hppc.LongHashSet)1