Package org.xtreemfs.babudb.index

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


            tree.insert(keys[i], vals[i]);
            map.put(keys[i], vals[i]);
        }
       
        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()));
       
        // create, materialize and link a new snapshot
        int snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE, snapId);
View Full Code Here


        int snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE, snapId);
        tree.linkToSnapshot(SNAP_FILE);
       
        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()));
       
        // insert some more keys-value pairs
        byte[][] newKeys = new byte[][] { "00001".getBytes(), "00006".getBytes(), "00002".getBytes(),
            "00007".getBytes(), "00008".getBytes(), "00009".getBytes(), "00003".getBytes() };
View Full Code Here

            else
                map.remove(newKeys[i]);
        }
       
        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();
View Full Code Here

        snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE2, snapId);
        tree.linkToSnapshot(SNAP_FILE2);
       
        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()));
       
        // delete all entries
        for (byte[] key : keys) {
            map.remove(key);
View Full Code Here

       
        snapId = tree.createSnapshot();
        tree.materializeSnapshot(SNAP_FILE4, snapId);
        tree.linkToSnapshot(SNAP_FILE4);
       
        assertEquals(null, tree.lookup("test".getBytes()));
       
        tree.destroy();
    }
   
    public void testPrefixLookups() throws Exception {
View Full Code Here

        int hits = 0;
        long t0 = System.currentTimeMillis();
        for (int i = 0; i < lookups; i++) {
           
            byte[] key = createRandomString(minChar, maxChar, minStrLen, maxStrLen).getBytes();
            byte[] result = tree.lookup(key);
            if (result != null)
                hits++;
           
            if (i % 100000 == 0)
                System.out.println(i);
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.