18 #ifndef FOEDUS_STORAGE_ARRAY_ARRAY_STORAGE_PIMPL_HPP_
19 #define FOEDUS_STORAGE_ARRAY_ARRAY_STORAGE_PIMPL_HPP_
128 bool install_volatile,
134 bool install_volatile,
156 uint16_t payload_offset,
159 template <
typename T>
164 uint16_t payload_offset);
175 template <
typename T>
178 uint16_t payload_offset,
194 const void *payload, uint16_t payload_offset, uint16_t payload_count)
ALWAYS_INLINE;
195 template <
typename T>
197 T payload, uint16_t payload_offset);
204 uint16_t payload_offset,
207 template <
typename T>
215 template <
typename T>
217 T* value, uint16_t payload_offset);
218 template <
typename T>
223 uint16_t payload_offset);
247 bool* snapshot_page_batch);
253 uint16_t* index_batch,
254 bool* snapshot_page_batch);
291 const uint16_t* index_in_parents,
297 const uint16_t* index_in_parents,
311 uint16_t index_in_parent) {
320 reinterpret_cast<Page**>(out),
321 reinterpret_cast<const Page*>(parent),
328 if (page->is_leaf()) {
347 reinterpret_cast<Page**>(out),
356 "ArrayStorageControlBlock is too large.");
361 #endif // FOEDUS_STORAGE_ARRAY_ARRAY_STORAGE_PIMPL_HPP_
ErrorStack verify_single_thread(thread::Thread *context)
uint8_t levels_
Number of levels.
ErrorCode locate_record_for_read_batch(thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, Record **out_batch, bool *snapshot_page_batch)
ErrorCode locate_record_for_read(thread::Thread *context, ArrayOffset offset, Record **out, bool *snapshot_record) __attribute__((always_inline))
const ArrayMetadata & get_meta() const
Represents one record in our key-value store.
StorageStatus status_
Status of the storage.
Represents a pointer to another page (usually a child page).
The storage has been marked for drop and can't be used.
Definitions of IDs in this package and a few related constant values.
ErrorCode follow_pointers_for_write_batch(thread::Thread *context, uint16_t batch_size, ArrayPage **parents, const uint16_t *index_in_parents, ArrayPage **out)
Pimpl object of ArrayStorage.
ErrorCode get_record_for_write(thread::Thread *context, ArrayOffset offset, Record **record) __attribute__((always_inline))
ErrorCode get_record(thread::Thread *context, ArrayOffset offset, void *payload, uint16_t payload_offset, uint16_t payload_count) __attribute__((always_inline))
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
ErrorCode lookup_for_read_batch(thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, ArrayPage **out_batch, uint16_t *index_batch, bool *snapshot_page_batch)
uint16_t get_snapshot_drop_volatile_pages_threshold() const
Represents a key-value store based on a dense and regular array.
ErrorCode locate_record_for_write(thread::Thread *context, ArrayOffset offset, Record **out) __attribute__((always_inline))
Represents one thread running on one NUMA core.
uint64_t intervals_[8]
intervals_[x] is the range of array offset in one page of level-x.
uint64_t ArrayOffset
The only key type in array storage.
Represents a pointer to a volatile page with modification count for preventing ABA.
Forward declarations of classes in root package.
Persistent status part of Transaction ID.
ErrorCode get_record_primitive(thread::Thread *context, ArrayOffset offset, T *payload, uint16_t payload_offset)
Brings error stacktrace information as return value of functions.
Represents one data page in Array Storage.
void array_volatile_page_init(const VolatilePageInitArguments &args)
volatile page initialize callback for ArrayPage.
The storage has been created and ready for use.
ErrorCode get_record_payload(thread::Thread *context, ArrayOffset offset, const void **payload) __attribute__((always_inline))
Forward declarations of classes in array storage package.
ErrorCode get_root_page(thread::Thread *context, bool for_write, ArrayPage **out) __attribute__((always_inline))
ErrorCode follow_page_pointer(storage::VolatilePageInit page_initializer, bool tolerate_null_pointer, bool will_modify, bool take_ptr_set_snapshot, storage::DualPagePointer *pointer, storage::Page **page, const storage::Page *parent, uint16_t index_in_parent)
A general method to follow (read) a page pointer.
void report_page_distribution()
bool is_valid() const __attribute__((always_inline))
uint16_t get_payload_size() const
soc::SharedMutex status_mutex_
A mutex that can be placed in shared memory and used from multiple processes.
ErrorCode lookup_for_write(thread::Thread *context, ArrayOffset offset, ArrayPage **out, uint16_t *index) __attribute__((always_inline))
This version always returns a volatile page, installing a new one if needed.
ErrorCode increment_record(thread::Thread *context, ArrayOffset offset, T *value, uint16_t payload_offset)
DualPagePointer root_page_pointer_
Points to the root page (or something equivalent).
If you want more than this, you should loop.
ErrorCode overwrite_record(thread::Thread *context, ArrayOffset offset, const void *payload, uint16_t payload_offset, uint16_t payload_count) __attribute__((always_inline))
ArrayMetadata meta_
metadata of this storage.
ErrorCode lookup_for_read(thread::Thread *context, ArrayOffset offset, ArrayPage **out, uint16_t *index, bool *snapshot_page) __attribute__((always_inline))
ErrorCode prefetch_pages(thread::Thread *context, bool install_volatile, bool cache_snapshot, ArrayOffset from, ArrayOffset to)
defined in array_storage_prefetch.cpp
Forward declarations of classes in storage package.
ArrayStorageControlBlock *const control_block_
Database engine object that holds all resources and provides APIs.
ErrorCode get_record_for_write_batch(thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, Record **record_batch) __attribute__((always_inline))
uint16_t get_levels() const
Shared data of this storage type.
ErrorCode follow_pointers_for_read_batch(thread::Thread *context, uint16_t batch_size, bool *in_snapshot, ArrayPage **parents, const uint16_t *index_in_parents, ArrayPage **out)
static std::vector< uint64_t > calculate_required_pages(uint64_t array_size, uint16_t payload)
Calculate leaf/interior pages we need.
static void release_pages_recursive(const memory::GlobalVolatilePageResolver &resolver, memory::PageReleaseBatch *batch, VolatilePagePointer volatile_page_id)
Used only from drop()
ArrayStoragePimpl(ArrayStorage *storage)
static std::vector< uint64_t > calculate_offset_intervals(uint8_t levels, uint16_t payload)
The offset interval a single page represents in each level.
Forward declarations of classes in memory package.
ArrayStorageControlBlock()=delete
ArrayOffset get_array_size() const
ArrayStoragePimpl(Engine *engine, ArrayStorageControlBlock *control_block)
ErrorCode lookup_for_write_batch(thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, Record **record_batch)
ErrorStack load(const StorageControlBlock &snapshot_block)
ErrorStack hcc_reset_all_temperature_stat_intermediate(VolatilePagePointer intermediate_page_id)
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Packages logic and required properties to calculate LookupRoute in array storage from offset...
ErrorCode follow_pointer(thread::Thread *context, bool in_snapshot, bool for_write, DualPagePointer *pointer, ArrayPage **out, const ArrayPage *parent, uint16_t index_in_parent) __attribute__((always_inline))
ErrorCode increment_record_oneshot(thread::Thread *context, ArrayOffset offset, T value, uint16_t payload_offset)
Definitions of IDs in this package and a few related constant values.
LookupRouteFinder route_finder_
ErrorCode get_record_primitive_batch(thread::Thread *context, uint16_t payload_offset, uint16_t batch_size, const ArrayOffset *offset_batch, T *payload_batch) __attribute__((always_inline))
ErrorStack hcc_reset_all_temperature_stat()
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Forward declarations of classes in thread package.
~ArrayStorageControlBlock()=delete
ErrorCode get_record_payload_batch(thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, const void **payload_batch) __attribute__((always_inline))
ErrorStack create(const Metadata &metadata)
ArrayStoragePimpl()=delete
#define ALWAYS_INLINE
A function suffix to hint that the function should always be inlined.
A base layout of shared data for all storage types.
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
ErrorCode
Enum of error codes defined in error_code.xmacro.
ErrorCode prefetch_pages_recurse(thread::Thread *context, bool install_volatile, bool cache_snapshot, ArrayOffset from, ArrayOffset to, ArrayPage *page)
ErrorCode overwrite_record_primitive(thread::Thread *context, ArrayOffset offset, T payload, uint16_t payload_offset)
StorageStatus
Status of a storage.
uint8_t get_level() const