libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
foedus::storage::hash::HashCombo Struct Reference

A set of information that are used in many places, extracted from the given key. More...

Detailed Description

A set of information that are used in many places, extracted from the given key.

These are just "usual" combo, and of course we occasionally need only some of them. In such a place, constructing this object is a waste, so be careful. This is a POD. Also, header-only except ostream.

Why This Does NOT Contain Key Itself
Because a pointer is not a self-contained information. The user has to be careful on the lifetime of pointee, most likely causing bugs. We initially contained key_, but we think it's more harm than good due to the lifetime issue. Thus, the user passes around key/key_length too.

Definition at line 48 of file hash_combo.hpp.

#include <hash_combo.hpp>

Collaboration diagram for foedus::storage::hash::HashCombo:

Public Member Functions

 HashCombo (const void *key, uint16_t key_length, const HashMetadata &meta)
 

Public Attributes

HashValue hash_
 
HashBin bin_
 
BloomFilterFingerprint fingerprint_
 
IntermediateRoute route_
 

Friends

std::ostream & operator<< (std::ostream &o, const HashCombo &v)
 

Constructor & Destructor Documentation

foedus::storage::hash::HashCombo::HashCombo ( const void *  key,
uint16_t  key_length,
const HashMetadata meta 
)

Definition at line 29 of file hash_combo.cpp.

References bin_, foedus::storage::hash::IntermediateRoute::construct(), foedus::storage::hash::DataPageBloomFilter::extract_fingerprint(), fingerprint_, foedus::storage::hash::HashMetadata::get_bin_shifts(), hash_, foedus::storage::hash::hashinate(), and route_.

29  {
30  uint8_t bin_shifts = meta.get_bin_shifts();
31  hash_ = hashinate(key, key_length);
32  bin_ = hash_ >> bin_shifts;
35 }
HashValue hashinate(const void *key, uint16_t key_length)
Calculates hash value for general input.
BloomFilterFingerprint fingerprint_
Definition: hash_combo.hpp:51
static BloomFilterFingerprint extract_fingerprint(HashValue fullhash)
static IntermediateRoute construct(HashBin bin)
Calculates the rout for the given hash bin.

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const HashCombo v 
)
friend

Definition at line 37 of file hash_combo.cpp.

37  {
38  o << "<HashCombo>"
39  << "<hash>" << assorted::Hex(v.hash_, 16) << "</hash>"
40  << "<bin>" << v.bin_ << "</bin>"
41  << v.fingerprint_
42  << v.route_
43  << "</HashCombo>";
44  return o;
45 }

Member Data Documentation

IntermediateRoute foedus::storage::hash::HashCombo::route_

The documentation for this struct was generated from the following files: