20 #include <glog/logging.h>
67 return pimpl.
create(static_cast<const HashMetadata&>(metadata));
71 return pimpl.
load(snapshot_block);
86 uint16_t* payload_capacity,
105 uint16_t payload_offset,
106 uint16_t payload_count,
120 template <
typename PAYLOAD>
127 uint16_t payload_offset,
146 uint16_t payload_count,
147 uint16_t physical_payload_hint) {
156 physical_payload_hint);
165 uint16_t payload_count,
166 uint16_t physical_payload_hint) {
175 physical_payload_hint);
198 uint16_t payload_offset,
199 uint16_t payload_count) {
211 template <
typename PAYLOAD>
218 uint16_t payload_offset) {
229 template <
typename PAYLOAD>
236 uint16_t payload_offset) {
249 <<
"<id>" << v.
get_id() <<
"</id>"
250 <<
"<name>" << v.
get_name() <<
"</name>"
282 bool intermediate_only,
283 uint32_t max_pages) {
290 #define EXPIN_2(x) template ErrorCode HashStorage::get_record_primitive< x > \
291 (thread::Thread* context, \
293 uint16_t key_length, \
294 const HashCombo& combo, \
296 uint16_t payload_offset, \
300 #define EXPIN_3(x) template ErrorCode HashStorage::overwrite_record_primitive< x > \
301 (thread::Thread* context, \
303 uint16_t key_length, \
304 const HashCombo& combo, \
306 uint16_t payload_offset)
309 #define EXPIN_5(x) template ErrorCode HashStorage::increment_record< x > \
310 (thread::Thread* context, \
312 uint16_t key_length, \
313 const HashCombo& combo, \
315 uint16_t payload_offset)
ErrorCode insert_record(thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_count)
Inserts a new record of the given key in this hash storage.
ErrorCode increment_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD *value, uint16_t payload_offset)
ErrorStack debugout_single_thread(Engine *engine, bool volatile_only, bool intermediate_only, uint32_t max_pages)
These are defined in hash_storage_debug.cpp.
StorageType get_type() const
Returns the type of this storage.
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Represents a record of write-access during a transaction.
ErrorCode overwrite_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_offset, uint16_t payload_count)
Represents one thread running on one NUMA core.
uint8_t get_levels() const
ErrorCode get_record_part(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, void *payload, uint16_t payload_offset, uint16_t payload_count, bool read_only)
Result of track_moved_record().
Brings error stacktrace information as return value of functions.
ErrorStack hcc_reset_all_temperature_stat()
For stupid reasons (I'm lazy!) these are defined in _debug.cpp.
ErrorCode get_record(thread::Thread *context, const void *key, uint16_t key_length, void *payload, uint16_t *payload_capacity, bool read_only)
Retrieves an entire payload of the given key in this hash storage.
ErrorCode insert_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_count, uint16_t physical_payload_hint)
ErrorCode increment_record(thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD *value, uint16_t payload_offset)
This one further optimizes overwrite methods for the frequent use case of incrementing some data in p...
Engine * engine_
Most attachable object stores an engine pointer (local engine), so we define it here.
ErrorStack load(const StorageControlBlock &snapshot_block)
ErrorCode overwrite_record(thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_offset, uint16_t payload_count)
Overwrites a part of one record of the given key in this hash storage.
xct::TrackMovedRecordResult track_moved_record(xct::RwLockableXctId *old_address, xct::WriteXctAccess *write_set)
Resolves a "moved" record.
ErrorStack verify_single_thread(Engine *engine)
ErrorStack create(const HashMetadata &metadata)
The MCS reader-writer lock variant of LockableXctId.
Represents one key-value store.
uint8_t get_bin_bits() const
Pimpl object of HashStorage.
ErrorCode get_record_part(thread::Thread *context, const void *key, uint16_t key_length, void *payload, uint16_t payload_offset, uint16_t payload_count, bool read_only)
Retrieves a part of the given key in this hash storage.
ErrorStack verify_single_thread(Engine *engine)
These are defined in hash_storage_verify.cpp.
std::ostream & operator<<(std::ostream &o, const HashCombo &v)
HashStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
const StorageName & get_name() const
Returns the unique name of this storage.
Declares all log types used in this storage type.
bool exists() const
Returns whether this storage is already created.
Database engine object that holds all resources and provides APIs.
ErrorCode upsert_record(thread::Thread *context, const void *key, uint16_t key_length, const void *payload, uint16_t payload_count)
Inserts a new record of the given key or replaces the existing one in this hash storage, or so-called upsert.
ErrorStack load(const StorageControlBlock &snapshot_block)
Shared data of this storage type.
xct::TrackMovedRecordResult track_moved_record(xct::RwLockableXctId *old_address, xct::WriteXctAccess *write_set)
StorageId get_id() const
Returns the unique ID of this storage.
A set of information that are used in many places, extracted from the given key.
ErrorCode get_record_primitive(thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD *payload, uint16_t payload_offset, bool read_only)
Retrieves a part of the given key in this storage as a primitive value.
Represents a key-value store based on a dense and regular hash.
HashBin get_bin_count() const
uint8_t get_bin_shifts() const
ErrorCode overwrite_record_primitive(thread::Thread *context, const void *key, uint16_t key_length, PAYLOAD payload, uint16_t payload_offset)
Overwrites a part of one record of the given key in this storage as a primitive value.
uint64_t HashBin
Represents a bin of a hash value.
ErrorStack hcc_reset_all_temperature_stat()
Resets all volatile pages' temperature stat to be zero in this storage.
ErrorCode get_record_primitive(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD *payload, uint16_t payload_offset, bool read_only)
ErrorStack debugout_single_thread(Engine *engine, bool volatile_only=false, bool intermediate_only=false, uint32_t max_pages=1024U)
A super-expensive and single-thread only debugging feature to write out gigantic human-readable texts...
const HashMetadata * get_hash_metadata() const
#define INSTANTIATE_ALL_NUMERIC_TYPES(M)
INSTANTIATE_ALL_TYPES minus std::string.
HashMetadata meta_
metadata of this storage.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
ErrorCode delete_record(thread::Thread *context, const void *key, uint16_t key_length)
Deletes a record of the given key from this hash storage.
A base layout of shared data for all storage types.
ErrorCode delete_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo)
ErrorCode
Enum of error codes defined in error_code.xmacro.
uint16_t get_root_children() const
ErrorCode overwrite_record_primitive(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, PAYLOAD payload, uint16_t payload_offset)
ErrorCode upsert_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, const void *payload, uint16_t payload_count, uint16_t physical_payload_hint)
ErrorCode get_record(thread::Thread *context, const void *key, uint16_t key_length, const HashCombo &combo, void *payload, uint16_t *payload_capacity, bool read_only)
HashStorage & operator=(const HashStorage &other)
ErrorStack create(const Metadata &metadata)