public long longMurmurHashCode() { return longMurmurHashCode(length); }
public Object lock(BolBuffer buffer, int seed) { return locks[Math.abs((int)buffer.longMurmurHashCode(seed) % locks.length)]; }
static private long getCuckoo(PointerReadableByteBufferFile readable, byte hashIndexHashFunctionCount, long hashIndexHeadOffset, long hashIndexMaxCapacity, byte hashIndexLongPrecision, BolBuffer compareKey, BolBuffer entryBuffer, BolBuffer keyBuffer, Rawhide rawhide) throws Exception { long hashCode = compareKey.longMurmurHashCode(); for (int i = 0; i < hashIndexHashFunctionCount; i++) { long hashIndex = Math.abs(LABAppendableIndex.moduloIndexForHash(hashCode, hashIndexMaxCapacity)); long readPointer = hashIndexHeadOffset + (hashIndex * hashIndexLongPrecision); long offset = readable.readVPLong(readPointer, hashIndexLongPrecision); if (offset == 0L) { return -1L; } rawhide.rawEntryToBuffer(readable, Math.abs(offset) - 1, entryBuffer); int c = rawhide.compareKey(entryBuffer, keyBuffer, compareKey); if (c == 0) { return Math.abs(offset) - 1; } if (offset > 0) { return -1; } hashCode = compareKey.longMurmurHashCode(hashCode); } return -1; }
static private long getFibCuckoo(PointerReadableByteBufferFile readable, byte hashIndexHashFunctionCount, long hashIndexHeadOffset, int twoPower, byte hashIndexLongPrecision, BolBuffer compareKey, BolBuffer entryBuffer, BolBuffer keyBuffer, Rawhide rawhide) throws Exception { long hashCode = compareKey.longMurmurHashCode(); for (int i = 0; i < hashIndexHashFunctionCount; i++) { long hashIndex = Math.abs(LABAppendableIndex.fibonacciIndexForHash(hashCode, twoPower)); long readPointer = hashIndexHeadOffset + (hashIndex * hashIndexLongPrecision); long offset = readable.readVPLong(readPointer, hashIndexLongPrecision); if (offset == 0L) { return -1L; } rawhide.rawEntryToBuffer(readable, Math.abs(offset) - 1, entryBuffer); int c = rawhide.compareKey(entryBuffer, keyBuffer, compareKey); if (c == 0) { return Math.abs(offset) - 1; } if (offset > 0) { return -1; } hashCode = compareKey.longMurmurHashCode(hashCode); } return -1; }
private long fibCuckooInsert(byte numHashFunctions, long length, byte hashIndexLongPrecision, int hashIndexMaxCapacityTwoPower, PointerReadableByteBufferFile c, BolBuffer k, long startOfEntryOffset, long[] histo) throws IOException { long displaced = -1; long hashCode = k.longMurmurHashCode(); for (int i = 0; i < numHashFunctions; i++) { long hi = fibonacciIndexForHash(hashCode, hashIndexMaxCapacityTwoPower); long pos = length + (hi * hashIndexLongPrecision); long v = c.readVPLong(pos, hashIndexLongPrecision); if (v == 0) { c.writeVPLong(pos, startOfEntryOffset + 1, hashIndexLongPrecision); // +1 so 0 can be null break; } else if (i + 1 == numHashFunctions) { displaced = Math.abs(v) - 1; c.writeVPLong(pos, (startOfEntryOffset + 1), hashIndexLongPrecision); // +1 so 0 can be null } else if (v > 0) { histo[i]++; c.writeVPLong(pos, -v, hashIndexLongPrecision); } hashCode = k.longMurmurHashCode(hashCode); } return displaced; }
private long cuckooInsert(byte numHashFunctions, long length, byte hashIndexLongPrecision, long hashIndexMaxCapacity, PointerReadableByteBufferFile c, BolBuffer k, long startOfEntryOffset, long[] histo) throws IOException { long displaced = -1; long hashCode = k.longMurmurHashCode(); for (int i = 0; i < numHashFunctions; i++) { long hi = moduloIndexForHash(hashCode, hashIndexMaxCapacity); long pos = length + (hi * hashIndexLongPrecision); long v = c.readVPLong(pos, hashIndexLongPrecision); if (v == 0) { c.writeVPLong(pos, startOfEntryOffset + 1, hashIndexLongPrecision); // +1 so 0 can be null break; } else if (i + 1 == numHashFunctions) { displaced = Math.abs(v) - 1; c.writeVPLong(pos, (startOfEntryOffset + 1), hashIndexLongPrecision); // +1 so 0 can be null } else if (v > 0) { histo[i]++; c.writeVPLong(pos, -v, hashIndexLongPrecision); } hashCode = k.longMurmurHashCode(hashCode); } return displaced; }
long hashIndexMaxCapacity) throws Exception { long hashCode = compareKey.longMurmurHashCode(); long hashIndex = Math.abs(LABAppendableIndex.fibonacciIndexForHash(hashCode, twoPower));
long hashCode = k.longMurmurHashCode(); long hashIndex = fibonacciIndexForHash(hashCode, twoPower);