18 #ifndef FOEDUS_STORAGE_STORAGE_ID_HPP_
19 #define FOEDUS_STORAGE_STORAGE_ID_HPP_
92 SnapshotPagePointer pointer) {
93 return pointer & 0x000000FFFFFFFFFFULL;
96 return static_cast<uint8_t
>(pointer >> 40);
99 return static_cast<uint16_t
>(pointer >> 48);
107 uint16_t snapshot_id,
111 return static_cast<uint64_t
>(snapshot_id) << 48
112 | static_cast<uint64_t>(node) << 40
146 default:
return "Unknown";
213 word = (
static_cast<uint64_t
>(numa_node) << 32) | offset;
217 return word == other.
word;
220 return word == other.
word;
223 return word != other.
word;
239 ret.
set(numa_node, offset);
290 reinterpret_cast<uint64_t*>(
this),
291 reinterpret_cast<const uint64_t*>(&expected),
292 reinterpret_cast<const uint64_t*>(&desired));
298 reinterpret_cast<uint64_t*>(
this),
299 reinterpret_cast<const uint64_t*>(&expected),
300 reinterpret_cast<const uint64_t*>(&desired));
314 #endif // FOEDUS_STORAGE_STORAGE_ID_HPP_
bool atomic_compare_exchange_weak(const DualPagePointer &expected, const DualPagePointer &desired)
128-bit atomic CAS (weak version) for the dual pointer.
thread::ThreadGroupId PartitionId
As partition=NUMA node, this is just a synonym of foedus::thread::ThreadGroupId.
uint64_t SnapshotLocalPageId
Represents a local page ID in each one snapshot file in some NUMA node.
void describe_volatile_pointer(std::ostream *o, VolatilePagePointer pointer)
Represents a pointer to another page (usually a child page).
The storage has been marked for drop and can't be used.
SnapshotLocalPageId extract_local_page_id_from_snapshot_pointer(SnapshotPagePointer pointer)
bool is_both_null() const
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
bool operator!=(const DualPagePointer &other) const
Typedefs of ID types used in thread package.
SnapshotPagePointer to_snapshot_page_pointer(uint16_t snapshot_id, uint8_t node, SnapshotLocalPageId local_page_id)
Represents a pointer to a volatile page with modification count for preventing ABA.
friend std::ostream & operator<<(std::ostream &o, const VolatilePagePointer &v)
The storage has been created and ready for use.
Definitions of IDs in this package and a few related constant values.
bool is_equivalent(const VolatilePagePointer &other) const
0 indicates invalid type.
VolatilePagePointer(const VolatilePagePointer &other)
VolatilePagePointer combine_volatile_page_pointer(uint8_t numa_node, memory::PagePoolOffset offset)
void set_offset_unsafe(memory::PagePoolOffset offset)
This is used only in special places (snapshot composer).
VolatilePagePointer volatile_pointer_
memory::PagePoolOffset get_offset() const
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
VolatilePagePointer(uint64_t the_word)
assorted::FixedString< 60 > StorageName
Represents a unique name of a storage.
SnapshotPagePointer snapshot_pointer_
uint16_t extract_snapshot_id_from_snapshot_pointer(SnapshotPagePointer pointer)
const uint8_t kVolatilePointerFlagSwappable
bool atomic_compare_exchange_strong(const DualPagePointer &expected, const DualPagePointer &desired)
128-bit atomic CAS (strong version) for the dual pointer.
void set(uint8_t numa_node, memory::PagePoolOffset offset)
const char * to_storage_type_name(StorageType type)
Gives a string representation of StorageType.
uint8_t extract_numa_node_from_snapshot_pointer(SnapshotPagePointer pointer)
StorageType
Type of the storage, such as hash.
void describe_snapshot_pointer(std::ostream *o, SnapshotPagePointer pointer)
VolatilePagePointer construct_volatile_page_pointer(uint64_t word)
Initial state, which means the storage has not been created yet.
bool operator==(const DualPagePointer &other) const
bool operator!=(const VolatilePagePointer &other) const
#define STATIC_SIZE_CHECK(desired, actual)
bool operator==(const VolatilePagePointer &other) const
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
bool raw_atomic_compare_exchange_strong_uint128(uint64_t *ptr, const uint64_t *old_value, const uint64_t *new_value)
Atomic 128-bit CAS, which is not in the standard yet.
uint8_t get_numa_node() const
Raw atomic operations that work for both C++11 and non-C++11 code.
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
friend std::ostream & operator<<(std::ostream &o, const DualPagePointer &v)
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
uint32_t Checksum
Checksum of a snapshot page.
bool raw_atomic_compare_exchange_weak_uint128(uint64_t *ptr, const uint64_t *old_value, const uint64_t *new_value)
Weak version of raw_atomic_compare_exchange_strong_uint128().
void assert_valid_snapshot_local_page_id(SnapshotLocalPageId page_id)
StorageStatus
Status of a storage.