Search in sources :

Example 1 with IBitSet

use of org.apache.cassandra.utils.obs.IBitSet in project cassandra by apache.

the class FilterFactory method createFilter.

@SuppressWarnings("resource")
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 BloomFilter(hash, bitset);
}
Also used : OpenBitSet(org.apache.cassandra.utils.obs.OpenBitSet) OffHeapBitSet(org.apache.cassandra.utils.obs.OffHeapBitSet) IBitSet(org.apache.cassandra.utils.obs.IBitSet)

Example 2 with IBitSet

use of org.apache.cassandra.utils.obs.IBitSet in project cassandra by apache.

the class BloomFilterSerializer method deserialize.

@SuppressWarnings("resource")
public static BloomFilter deserialize(DataInput in, boolean offheap) throws IOException {
    int hashes = in.readInt();
    IBitSet bs = offheap ? OffHeapBitSet.deserialize(in) : OpenBitSet.deserialize(in);
    return new BloomFilter(hashes, bs);
}
Also used : IBitSet(org.apache.cassandra.utils.obs.IBitSet)

Aggregations

IBitSet (org.apache.cassandra.utils.obs.IBitSet)2 OffHeapBitSet (org.apache.cassandra.utils.obs.OffHeapBitSet)1 OpenBitSet (org.apache.cassandra.utils.obs.OpenBitSet)1