Examples of prefixLookup()


Examples of org.xtreemfs.babudb.api.database.DatabaseRO.prefixLookup()

       
        // check if the snapshot still contains the old values
        for (int i = 1; i < 4; i++)
            assertEquals("Value" + i, new String(snap1.lookup(0, ("Key" + i).getBytes(), null).get()));
       
        Iterator<Entry<byte[], byte[]>> it = snap1.prefixLookup(0, "Key".getBytes(), null).get();
        for (int i = 1; i < 4; i++) {
            Entry<byte[], byte[]> next = it.next();
            assertEquals("Key" + i, new String(next.getKey()));
            assertEquals("Value" + i, new String(next.getValue()));
        }
View Full Code Here

Examples of org.xtreemfs.babudb.api.database.DatabaseRO.prefixLookup()

            assertEquals("Value" + i, new String(next.getValue()));
        }
       
        assertNull(snap1.lookup(1, "bla".getBytes(), null).get());
       
        it = snap2.prefixLookup(0, "Key".getBytes(), null).get();
        for (int i = 1; i < 4; i++) {
            Entry<byte[], byte[]> next = it.next();
            assertEquals("Key" + i, new String(next.getKey()));
            assertEquals("x", new String(next.getValue()));
        }
View Full Code Here

Examples of org.xtreemfs.babudb.api.database.DatabaseRO.prefixLookup()

        assertNull(snap1.lookup(0, "yagga".getBytes(), null).get());
        assertEquals("v1", new String(snap1.lookup(3, "foo".getBytes(), null).get()));
        assertEquals("v2", new String(snap1.lookup(3, "bar".getBytes(), null).get()));
        assertNull(snap1.lookup(0, "test2".getBytes(), null).get());
       
        Iterator<Entry<byte[], byte[]>> it = snap1.prefixLookup(0, null, null).get();
        Entry<byte[], byte[]> next = it.next();
        assertEquals("test", new String(next.getKey()));
        assertEquals("v2", new String(next.getValue()));
        next = it.next();
        assertEquals("testxyz", new String(next.getKey()));
View Full Code Here

Examples of org.xtreemfs.babudb.api.database.DatabaseRO.prefixLookup()

        assertNull(snap1.lookup(0, "yagga".getBytes(), null).get());
        assertEquals("v1", new String(snap1.lookup(3, "foo".getBytes(), null).get()));
        assertEquals("v2", new String(snap1.lookup(3, "bar".getBytes(), null).get()));
        assertNull(snap1.lookup(0, "test2".getBytes(), null).get());
       
        it = snap1.prefixLookup(0, null, null).get();
        next = it.next();
        assertEquals("test", new String(next.getKey()));
        assertEquals("v2", new String(next.getValue()));
        next = it.next();
        assertEquals("testxyz", new String(next.getKey()));
View Full Code Here

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

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

   
    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

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

        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

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

        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

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

            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

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

            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
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.