Package org.apache.cassandra.utils.obs

Examples of org.apache.cassandra.utils.obs.OpenBitSet


    public BloomFilter deserialize(DataInput dis) throws IOException
    {
        int hashes = dis.readInt();
        long bitLength = dis.readInt();
        OpenBitSet bs = new OpenBitSet(bitLength << 6);
        int pageSize = bs.getPageSize();
        int pageCount = bs.getPageCount();

        for (int p = 0; p < pageCount; p++)
        {
            long[] bits = bs.getPage(p);
            for (int i = 0; i < pageSize && bitLength-- > 0; i++)
                bits[i] = dis.readLong();
        }

        return createFilter(hashes, bs);
View Full Code Here


    public final OpenBitSet bitset;

    BloomFilter(int hashes, long numElements, int bucketsPer)
    {
        hashCount = hashes;
        bitset = new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

    public BloomFilter deserialize(DataInput dis) throws IOException
    {
        int hashes = dis.readInt();
        long bitLength = dis.readInt();
        OpenBitSet bs = new OpenBitSet(bitLength << 6);
        int pageSize = bs.getPageSize();
        int pageCount = bs.getPageCount();

        for (int p = 0; p < pageCount; p++)
        {
            long[] bits = bs.getPage(p);
            for (int i = 0; i < pageSize && bitLength-- > 0; i++)
                bits[i] = dis.readLong();
        }

        return new BloomFilter(hashes, bs);
View Full Code Here

        return serializer_;
    }

    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        return new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

        int hashes = dis.readInt();
        int bitLength = dis.readInt();
        long[] bits = new long[bitLength];
        for (int i = 0; i < bitLength; i++)
            bits[i] = dis.readLong();
        OpenBitSet bs = new OpenBitSet(bits, bitLength);
        return new BloomFilter(hashes, bs);
    }
View Full Code Here

        return serializer_;
    }

    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        return new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

    }

    @Test
    public void testOffHeapCompatibility() throws IOException
    {
        OpenBitSet bs = new OpenBitSet(100000);
        populateAndReserialize(bs);
    }
View Full Code Here

    }

    private static IFilter createFilter(int hash, long numElements, int bucketsPer, boolean offheap)
    {
        long numBits = (numElements * bucketsPer) + BITSET_EXCESS;
        IBitSet bitset = offheap ? new OffHeapBitSet(numBits) : new OpenBitSet(numBits);
        return new Murmur3BloomFilter(hash, bitset);
    }
View Full Code Here

    @Test
    public void testExpectedCompatablity() throws IOException
    {
        DataInputStream dis = new DataInputStream(new FileInputStream(new File(LEGACY_SST_FILE)));
        dis.readInt(); // bloom filter hash count
        OpenBitSet bs = OpenBitSet.deserialize(dis);

        dis = new DataInputStream(new FileInputStream(new File(LEGACY_SST_FILE)));
        dis.readInt(); // bloom filter hash count
        OffHeapBitSet obs = OffHeapBitSet.deserialize(dis);
View Full Code Here

    }

    @Test
    public void testOffHeapCompatibility() throws IOException
    {
        OpenBitSet bs = new OpenBitSet(100000);
        populateAndReserialize(bs);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.utils.obs.OpenBitSet

Copyright © 2018 www.massapicom. 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.