Package org.xtreemfs.babudb.index

Examples of org.xtreemfs.babudb.index.LSMTree.prefixLookup()


   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey);
    }
   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
View Full Code Here


   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey,snapId);
    }
   
}
View Full Code Here

        assertEquals(null, tree.lookup("ertz".getBytes()));
        assertEquals(null, tree.lookup("yaggaa".getBytes()));
        assertEquals(value, tree.lookup("zwum".getBytes()));
        assertEquals(null, tree.lookup("x".getBytes()));
       
        Iterator<Entry<byte[], byte[]>> it = tree.prefixLookup(new byte[0]);
        int i = 0;
        for (; it.hasNext(); i++)
            it.next();
       
        assertEquals(4, i);
View Full Code Here

        for (byte[] key : map.keySet())
            assertEquals(new String(map.get(key)), new String(tree.lookup(key)));
        assertEquals(new String(map.firstKey()), new String(tree.firstEntry().getKey()));
       
        // perform a prefix lookup
        Iterator<Entry<byte[], byte[]>> it = tree.prefixLookup(new byte[0]);
        Iterator<Entry<byte[], byte[]>> entries = map.entrySet().iterator();
       
        int count = 0;
        for (; it.hasNext(); count++) {
           
View Full Code Here

            assertEquals(new String(entry.getKey()), new String(mapEntry.getKey()));
            assertEquals(new String(entry.getValue()), new String(mapEntry.getValue()));
        }
       
        // perform reverse a prefix lookup
        it = tree.prefixLookup(new byte[0], false);
        entries = map.descendingMap().entrySet().iterator();
       
        count = 0;
        for (; it.hasNext(); count++) {
           
View Full Code Here

            map.remove(key);
            tree.delete(key);
        }
       
        assertEquals(0, map.size());
        assertFalse(tree.prefixLookup(new byte[0]).hasNext());
       
        // create, materialize and link a new snapshot
        snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE3, snapId);
        tree.linkToSnapshot(SNAP_FILE3);
View Full Code Here

        // create, materialize and link a new snapshot
        snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE3, snapId);
        tree.linkToSnapshot(SNAP_FILE3);
       
        it = tree.prefixLookup(new byte[0]);
        assertFalse(it.hasNext());
       
        tree.insert("test".getBytes(), "test".getBytes());
        tree.delete("test".getBytes());
       
View Full Code Here

        }
       
        // peform prefix lookups
       
        // current tree, ascending
        Iterator<Entry<byte[], byte[]>> it = tree.prefixLookup(new byte[0], true);
        Iterator<byte[]> itExpected = map3.values().iterator();
        while (it.hasNext())
            assertEquals(itExpected.next(), it.next().getValue());
        assertFalse(itExpected.hasNext());
       
View Full Code Here

        while (it.hasNext())
            assertEquals(itExpected.next(), it.next().getValue());
        assertFalse(itExpected.hasNext());
       
        // current tree, descending
        it = tree.prefixLookup(new byte[0], false);
        itExpected = map3.descendingMap().values().iterator();
        while (it.hasNext())
            assertEquals(itExpected.next(), it.next().getValue());
        assertFalse(itExpected.hasNext());
       
View Full Code Here

        while (it.hasNext())
            assertEquals(itExpected.next(), it.next().getValue());
        assertFalse(itExpected.hasNext());
       
        // snapshot 2, ascending
        it = tree.prefixLookup(new byte[0], snap2, true);
        itExpected = map2.values().iterator();
        while (it.hasNext())
            assertEquals(itExpected.next(), it.next().getValue());
        assertFalse(itExpected.hasNext());
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.