Package org.xtreemfs.babudb.index.reader

Examples of org.xtreemfs.babudb.index.reader.DiskIndex.lookup()


       
        DiskIndex index = indexMap.get(indexId);
        if (index == null)
            throw new BabuDBException(ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
       
        return index.lookup(key);
    }
   
    @Override
    public ResultSet<byte[], byte[]> directPrefixLookup(int indexId, byte[] key, boolean ascending) throws BabuDBException {
       
View Full Code Here


        entries = new byte[][] { "test".getBytes() };
        populateDiskIndex(entries);
        diskIndex = new DiskIndex(PATH2, new DefaultByteRangeComparator(), COMPRESSED, MMAPED);
       
        for (byte[] entry : entries)
            assertEquals(0, COMP.compare(entry, diskIndex.lookup(entry)));
        assertEquals(entries.length, diskIndex.numKeys());
        diskIndex.destroy();
       
        // create a new disk index and look up each key
        entries = new byte[][] { new byte[] { '\0' }, "word".getBytes(), new byte[] { '#' } };
View Full Code Here

       
        populateDiskIndex(entries);
        diskIndex = new DiskIndex(PATH2, DefaultByteRangeComparator.getInstance(), COMPRESSED, MMAPED);
       
        for (byte[] entry : entries)
            assertEquals(0, COMP.compare(entry, diskIndex.lookup(entry)));
        assertEquals(entries.length, diskIndex.numKeys());
        diskIndex.destroy();
       
        // create another disk index and look up each key
        entries = new byte[][] { "fdsaf".getBytes(), "blubberbla".getBytes(), "zzz".getBytes(),
View Full Code Here

            "aaa".getBytes(), "aab".getBytes() };
        populateDiskIndex(entries);
        diskIndex = new DiskIndex(PATH2, new DefaultByteRangeComparator(), COMPRESSED, MMAPED);
       
        for (byte[] entry : entries)
            assertEquals(0, COMP.compare(entry, diskIndex.lookup(entry)));
        assertEquals(entries.length, diskIndex.numKeys());
        diskIndex.destroy();
       
        // create a larger disk index and look up each key
        entries = createRandomByteArrays(NUM_ENTRIES);
View Full Code Here

        entries = createRandomByteArrays(NUM_ENTRIES);
        populateDiskIndex(entries);
        diskIndex = new DiskIndex(PATH2, new DefaultByteRangeComparator(), COMPRESSED, MMAPED);
       
        for (byte[] entry : entries)
            assertEquals(0, COMP.compare(entry, diskIndex.lookup(entry)));
        assertEquals(entries.length, diskIndex.numKeys());
        diskIndex.destroy();
    }
   
    public void testCompleteLookup() throws Exception {
View Full Code Here

        // long t0 = System.currentTimeMillis();
        // int count = 0;
        while (it.hasNext()) {
            // count++;
            Entry<byte[], byte[]> next = it.next();
            byte[] result = diskIndex.lookup(next.getKey());
            assertEquals(0, COMP.compare(result, next.getValue()));
            // if (count % 1000 == 0)
            // System.out.println(count);
        }
        // long time = System.currentTimeMillis() - t0;
View Full Code Here

          } else {
            key = DataGenerator.createRandomString(minChar, maxChar, maxStrLen+1, maxStrLen*2).getBytes();
          }
         
            long t0 = System.currentTimeMillis();
            byte[] result = diskIndex.lookup(key);
            sumLookups += System.currentTimeMillis() - t0;
            if (result != null)
                hits++;
           
            //if (i % 100000 == 0 && verbose)
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.