18 #ifndef FOEDUS_STORAGE_HASH_HASHINATE_HPP_
19 #define FOEDUS_STORAGE_HASH_HASHINATE_HPP_
85 kHashDataPageBloomFilterBits == (1U << kHashDataPageBloomFilterIndexSize),
86 "If you change the size of bloom filter, change kHashDataPageBloomFilterIndexSize accordingly.");
109 if (indexes_[k] != other.
indexes_[k]) {
148 std::memset(values_, 0,
sizeof(values_));
154 ASSERT_ND(fingerprint.indexes_[k] < kHashDataPageBloomFilterBits);
155 uint8_t byte_index = fingerprint.indexes_[k] / 8U;
156 uint8_t bit_index = fingerprint.indexes_[k] % 8U;
157 if ((values_[byte_index] & (1U << bit_index)) == 0) {
167 ASSERT_ND(fingerprint.indexes_[k] < kHashDataPageBloomFilterBits);
168 uint8_t byte_index = fingerprint.indexes_[k] / 8U;
169 uint8_t bit_index = fingerprint.indexes_[k] % 8U;
170 values_[byte_index] |= (1U << bit_index);
208 for (uint16_t i = 1; i <= 8U; ++i) {
211 if (route[8U - i] != rhs.
route[8U - i]) {
212 return route[8U - i] < rhs.
route[8U - i];
238 while (remaining > 0) {
254 #endif // FOEDUS_STORAGE_HASH_HASHINATE_HPP_
const uint8_t kHashDataPageBloomFilterIndexSize
How many bits we need in order to represent an index in bloom filter in each HashDataPage.
uint16_t indexes_[kHashDataPageBloomFilterHashes]
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
const uint64_t kXxhashKeySeed
Default seed value used for xxhash's xxh32/64 to hashinate keys.
bool contains(const BloomFilterFingerprint &fingerprint) const __attribute__((always_inline))
const uint8_t kHashDataPageBloomFilterHashes
Number of hash functions (k) of bloom filter in each HashDataPage.
bool operator==(const BloomFilterFingerprint &other) const
friend std::ostream & operator<<(std::ostream &o, const BloomFilterFingerprint &v)
const uint8_t kHashMaxLevels
Max level of intermediate pages.
void clear()
usually zero-cleared as part of a data page, but in case of specifically clearing this ...
HashValue hashinate(const void *key, uint16_t key_length)
Calculates hash value for general input.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
const uint16_t kHashDataPageBloomFilterBytes
Byte size of bloom filter in each HashDataPage.
#define CXX11_STATIC_ASSERT(expr, message)
Used in public headers in place of "static_assert" of C++11.
const uint16_t kHashDataPageBloomFilterBits
Bit size of bloom filter in each HashDataPage.
friend std::ostream & operator<<(std::ostream &o, const DataPageBloomFilter &v)
uint8_t values_[kHashDataPageBloomFilterBytes]
static BloomFilterFingerprint extract_fingerprint(HashValue fullhash)
uint64_t HashBin
Represents a bin of a hash value.
void add(const BloomFilterFingerprint &fingerprint) __attribute__((always_inline))
Adds the fingerprint to this bloom filter.
const HashValue kHashDataPageBloomFilterIndexMask
A fingerprint for bloom filter in each HashDataPage.
To quickly check whether a HashDataPage might contain a specific hash value, we maintain a non-counti...
const uint8_t kHashIntermediatePageFanout
Number of pointers in an intermediate page of hash storage.
const uint64_t kHashMaxBins[]
kHashTotalBins[n] gives the maximum number of hash bins n-level hash can hold.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definitions of IDs in this package and a few related constant values.
#define ALWAYS_INLINE
A function suffix to hint that the function should always be inlined.
bool operator!=(const BloomFilterFingerprint &other) const
Forward declarations of classes in hash storage package.
uint64_t HashValue
Represents a full 64-bit hash value calculated from a key.