libfoedus-core
FOEDUS Core Library
foedus::storage::array::ArrayStorage Class Referencefinal

Represents a key-value store based on a dense and regular array. More...

Detailed Description

Represents a key-value store based on a dense and regular array.

Definition at line 47 of file array_storage.hpp.

#include <array_storage.hpp>

Inheritance diagram for foedus::storage::array::ArrayStorage:
Collaboration diagram for foedus::storage::array::ArrayStorage:

Public Types

typedef ArrayStoragePimpl ThisPimpl
 
typedef ArrayCreateLogType ThisCreateLogType
 
typedef ArrayMetadata ThisMetadata
 

Public Member Functions

 ArrayStorage ()
 
 ArrayStorage (Engine *engine, ArrayStorageControlBlock *control_block)
 
 ArrayStorage (Engine *engine, StorageControlBlock *control_block)
 
 ArrayStorage (Engine *engine, StorageId id)
 
 ArrayStorage (Engine *engine, const StorageName &name)
 
 ArrayStorage (const ArrayStorage &other)
 
ArrayStorageoperator= (const ArrayStorage &other)
 
const ArrayMetadataget_array_metadata () const
 
ErrorStack create (const Metadata &metadata)
 
ErrorStack load (const StorageControlBlock &snapshot_block)
 
ErrorStack drop ()
 
ErrorCode prefetch_pages (thread::Thread *context, bool install_volatile, bool cache_snapshot, ArrayOffset from, ArrayOffset to)
 Prefetch data pages in this storage. More...
 
uint16_t get_payload_size () const
 Returns byte size of one record in this array storage without internal overheads. More...
 
ArrayOffset get_array_size () const
 Returns the size of this array. More...
 
uint8_t get_levels () const
 Returns the number of levels. More...
 
ErrorCode get_record (thread::Thread *context, ArrayOffset offset, void *payload)
 Retrieves one record of the given offset in this array storage. More...
 
ErrorCode get_record (thread::Thread *context, ArrayOffset offset, void *payload, uint16_t payload_offset, uint16_t payload_count)
 Retrieves a part of record of the given offset in this array storage. More...
 
template<typename T >
ErrorCode get_record_primitive (thread::Thread *context, ArrayOffset offset, T *payload, uint16_t payload_offset)
 Retrieves a part of record of the given offset as a primitive type in this array storage. More...
 
ErrorCode get_record_payload (thread::Thread *context, ArrayOffset offset, const void **payload)
 Retrieves a pointer to the entire payload. More...
 
ErrorCode get_record_for_write (thread::Thread *context, ArrayOffset offset, Record **record)
 Retrieves a pointer to the entire record for write (thus always in volatile page). More...
 
template<typename T >
ErrorCode get_record_primitive_batch (thread::Thread *context, uint16_t payload_offset, uint16_t batch_size, const ArrayOffset *offset_batch, T *payload)
 batched interface More...
 
ErrorCode get_record_payload_batch (thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, const void **payload_batch)
 
ErrorCode get_record_for_write_batch (thread::Thread *context, uint16_t batch_size, const ArrayOffset *offset_batch, Record **record_batch)
 
ErrorCode overwrite_record (thread::Thread *context, ArrayOffset offset, const void *payload)
 Overwrites one record of the given offset in this array storage. More...
 
ErrorCode overwrite_record (thread::Thread *context, ArrayOffset offset, const void *payload, uint16_t payload_offset, uint16_t payload_count)
 Overwrites a part of one record of the given offset in this array storage. More...
 
template<typename T >
ErrorCode overwrite_record_primitive (thread::Thread *context, ArrayOffset offset, T payload, uint16_t payload_offset)
 Overwrites a part of record of the given offset as a primitive type in this array storage. More...
 
ErrorCode overwrite_record (thread::Thread *context, ArrayOffset offset, Record *record, const void *payload, uint16_t payload_offset, uint16_t payload_count)
 Overwrites a part of the pre-searched record in this array storage. More...
 
template<typename T >
ErrorCode overwrite_record_primitive (thread::Thread *context, ArrayOffset offset, Record *record, T payload, uint16_t payload_offset)
 Overwrites a part of pre-searched record as a primitive type in this array storage. More...
 
template<typename T >
ErrorCode increment_record (thread::Thread *context, ArrayOffset offset, T *value, uint16_t payload_offset)
 This one further optimizes overwrite_record_primitive() for the frequent use case of incrementing some data in primitive type. More...
 
template<typename T >
ErrorCode increment_record_oneshot (thread::Thread *context, ArrayOffset offset, T value, uint16_t payload_offset)
 This is a faster increment that does not return the value after increment. More...
 
ErrorStack hcc_reset_all_temperature_stat ()
 Resets all volatile pages' temperature stat to be zero in this storage. More...
 
ErrorStack verify_single_thread (thread::Thread *context)
 
- Public Member Functions inherited from foedus::storage::Storage< ArrayStorageControlBlock >
 Storage ()
 
 Storage (Engine *engine, ArrayStorageControlBlock *control_block)
 
 Storage (Engine *engine, StorageControlBlock *control_block)
 
 Storage (Engine *engine, StorageId id)
 Shorthand for engine->get_storage_manager()->get_storage(id) More...
 
 Storage (Engine *engine, const StorageName &name)
 Shorthand for engine->get_storage_manager()->get_storage(name) More...
 
 Storage (const Storage &other)
 
Storageoperator= (const Storage &other)
 
StorageId get_id () const
 Returns the unique ID of this storage. More...
 
StorageType get_type () const
 Returns the type of this storage. More...
 
const StorageNameget_name () const
 Returns the unique name of this storage. More...
 
const Metadataget_metadata () const
 Returns the metadata of this storage. More...
 
bool exists () const
 Returns whether this storage is already created. More...
 
- Public Member Functions inherited from foedus::Attachable< ArrayStorageControlBlock >
 Attachable ()
 
 Attachable (Engine *engine)
 
 Attachable (Engine *engine, ArrayStorageControlBlock *control_block)
 
 Attachable (ArrayStorageControlBlock *control_block)
 
 Attachable (const Attachable &other)
 
virtual ~Attachable ()
 
Attachableoperator= (const Attachable &other)
 
virtual void attach (ArrayStorageControlBlock *control_block)
 Attaches to the given shared memory. More...
 
bool is_attached () const
 Returns whether the object has been already attached to some shared memory. More...
 
ArrayStorageControlBlock * get_control_block () const
 
Engineget_engine () const
 
void set_engine (Engine *engine)
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from foedus::Attachable< ArrayStorageControlBlock >
Engineengine_
 Most attachable object stores an engine pointer (local engine), so we define it here. More...
 
ArrayStorageControlBlock * control_block_
 The shared data on shared memory that has been initialized in some SOC or master engine. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

foedus::storage::array::ArrayStorage::ArrayStorage ( )

Definition at line 31 of file array_storage.cpp.

31 : Storage<ArrayStorageControlBlock>() {}
foedus::storage::array::ArrayStorage::ArrayStorage ( Engine engine,
ArrayStorageControlBlock control_block 
)

Definition at line 32 of file array_storage.cpp.

References ASSERT_ND, foedus::storage::Storage< ArrayStorageControlBlock >::exists(), foedus::storage::Storage< ArrayStorageControlBlock >::get_type(), and foedus::storage::kArrayStorage.

33  : Storage<ArrayStorageControlBlock>(engine, control_block) {
35 }
StorageType get_type() const
Returns the type of this storage.
Definition: storage.hpp:150
bool exists() const
Returns whether this storage is already created.
Definition: storage.hpp:169
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

foedus::storage::array::ArrayStorage::ArrayStorage ( Engine engine,
StorageControlBlock control_block 
)

Definition at line 36 of file array_storage.cpp.

References ASSERT_ND, foedus::storage::Storage< ArrayStorageControlBlock >::exists(), foedus::storage::Storage< ArrayStorageControlBlock >::get_type(), and foedus::storage::kArrayStorage.

37  : Storage<ArrayStorageControlBlock>(engine, control_block) {
39 }
StorageType get_type() const
Returns the type of this storage.
Definition: storage.hpp:150
bool exists() const
Returns whether this storage is already created.
Definition: storage.hpp:169
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

foedus::storage::array::ArrayStorage::ArrayStorage ( Engine engine,
StorageId  id 
)

Definition at line 40 of file array_storage.cpp.

41  : Storage<ArrayStorageControlBlock>(engine, id) {}
foedus::storage::array::ArrayStorage::ArrayStorage ( Engine engine,
const StorageName name 
)

Definition at line 42 of file array_storage.cpp.

43  : Storage<ArrayStorageControlBlock>(engine, name) {}
foedus::storage::array::ArrayStorage::ArrayStorage ( const ArrayStorage other)

Definition at line 44 of file array_storage.cpp.

45  : Storage<ArrayStorageControlBlock>(other.engine_, other.control_block_) {
46 }

Member Function Documentation

ErrorStack foedus::storage::array::ArrayStorage::create ( const Metadata metadata)

Definition at line 52 of file array_storage.cpp.

References foedus::storage::array::ArrayStoragePimpl::create().

52  {
53  return ArrayStoragePimpl(this).create(metadata);
54 }

Here is the call graph for this function:

ErrorStack foedus::storage::array::ArrayStorage::drop ( )

Definition at line 227 of file array_storage_pimpl.cpp.

References foedus::Attachable< ArrayStorageControlBlock >::control_block_, foedus::Attachable< ArrayStorageControlBlock >::engine_, foedus::memory::EngineMemory::get_global_volatile_page_resolver(), foedus::Engine::get_memory_manager(), foedus::kRetOk, foedus::memory::PageReleaseBatch::release_all(), and foedus::storage::array::ArrayStoragePimpl::release_pages_recursive().

227  {
228  LOG(INFO) << "Uninitializing an array-storage " << *this;
229  if (!control_block_->root_page_pointer_.volatile_pointer_.is_null()) {
230  memory::PageReleaseBatch release_batch(engine_);
233  &release_batch,
234  control_block_->root_page_pointer_.volatile_pointer_);
235  release_batch.release_all();
236  control_block_->root_page_pointer_.volatile_pointer_.word = 0;
237  }
238  return kRetOk;
239 }
const GlobalVolatilePageResolver & get_global_volatile_page_resolver() const
Returns the page resolver to convert volatile page ID to page pointer.
Engine * engine_
Most attachable object stores an engine pointer (local engine), so we define it here.
Definition: attachable.hpp:107
ArrayStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Definition: attachable.hpp:111
static void release_pages_recursive(const memory::GlobalVolatilePageResolver &resolver, memory::PageReleaseBatch *batch, VolatilePagePointer volatile_page_id)
Used only from drop()
const ErrorStack kRetOk
Normal return value for no-error case.
memory::EngineMemory * get_memory_manager() const
See Memory Manager.
Definition: engine.cpp:50

Here is the call graph for this function:

const ArrayMetadata * foedus::storage::array::ArrayStorage::get_array_metadata ( ) const

Definition at line 59 of file array_storage_pimpl.cpp.

References foedus::Attachable< ArrayStorageControlBlock >::control_block_.

Referenced by foedus::storage::array::ArrayComposer::drop_root_volatile(), and foedus::storage::array::ArrayComposer::drop_volatiles().

59 { return &control_block_->meta_; }
ArrayStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Definition: attachable.hpp:111

Here is the caller graph for this function:

ArrayOffset foedus::storage::array::ArrayStorage::get_array_size ( ) const
uint8_t foedus::storage::array::ArrayStorage::get_levels ( ) const

Returns the number of levels.

Definition at line 58 of file array_storage_pimpl.cpp.

References foedus::Attachable< ArrayStorageControlBlock >::control_block_.

Referenced by foedus::storage::array::ArrayComposer::construct_root(), foedus::storage::array::ArrayPartitioner::design_partition(), and foedus::storage::array::ArrayComposer::drop_root_volatile().

58 { return control_block_->levels_; }
ArrayStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Definition: attachable.hpp:111

Here is the caller graph for this function:

uint16_t foedus::storage::array::ArrayStorage::get_payload_size ( ) const

Returns byte size of one record in this array storage without internal overheads.

ArrayStorage is a fix-sized storage, thus we have this interface in storage level rather than in record level.

Definition at line 56 of file array_storage_pimpl.cpp.

References foedus::Attachable< ArrayStorageControlBlock >::control_block_.

Referenced by foedus::storage::array::array_volatile_page_init(), foedus::storage::array::ArrayComposer::construct_root(), foedus::storage::array::ArrayComposer::drop_root_volatile(), get_record(), foedus::storage::array::operator<<(), and overwrite_record().

56 { return control_block_->meta_.payload_size_; }
ArrayStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Definition: attachable.hpp:111

Here is the caller graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record ( thread::Thread context,
ArrayOffset  offset,
void *  payload 
)

Retrieves one record of the given offset in this array storage.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[out]payloadWe copy the record to this address. Must be at least get_payload_size().
Precondition
offset < get_array_size()

Equivalent to get_record(context, offset, payload, 0, get_payload_size()).

Definition at line 65 of file array_storage_pimpl.cpp.

References get_payload_size().

66  {
67  return get_record(context, offset, payload, 0, get_payload_size());
68 }
uint16_t get_payload_size() const
Returns byte size of one record in this array storage without internal overheads. ...
ErrorCode get_record(thread::Thread *context, ArrayOffset offset, void *payload)
Retrieves one record of the given offset in this array storage.

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record ( thread::Thread context,
ArrayOffset  offset,
void *  payload,
uint16_t  payload_offset,
uint16_t  payload_count 
)

Retrieves a part of record of the given offset in this array storage.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[out]payloadWe copy the record to this address. Must be at least payload_count.
[in]payload_offsetWe copy from this byte position of the record.
[in]payload_countHow many bytes we copy.
Precondition
payload_offset + payload_count <= get_payload_size()
offset < get_array_size()

Definition at line 70 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::get_record().

71  {
72  return ArrayStoragePimpl(this).get_record(
73  context, offset, payload, payload_offset, payload_count);
74 }

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record_for_write ( thread::Thread context,
ArrayOffset  offset,
Record **  record 
)

Retrieves a pointer to the entire record for write (thus always in volatile page).

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[out]recordSets the pointer to the record in a volatile page.
Precondition
offset < get_array_size()

This is used to retrieve entire record without copying and also to prepare for writes. Though "record" is a non-const pointer, of course don't directly write to it. Use overwrite_xxx etc which does the pre-commit protocol to write. This also adds to read-set.

Definition at line 89 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::get_record_for_write().

92  {
93  return ArrayStoragePimpl(this).get_record_for_write(context, offset, record);
94 }

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record_for_write_batch ( thread::Thread context,
uint16_t  batch_size,
const ArrayOffset offset_batch,
Record **  record_batch 
)

Definition at line 655 of file array_storage_pimpl.cpp.

References CHECK_ERROR_CODE, foedus::storage::array::ArrayStoragePimpl::get_record_for_write_batch(), foedus::storage::array::ArrayStoragePimpl::kBatchMax, and foedus::kErrorCodeOk.

659  {
660  ArrayStoragePimpl pimpl(this);
661  for (uint16_t cur = 0; cur < batch_size;) {
662  uint16_t chunk = batch_size - cur;
663  if (chunk > ArrayStoragePimpl::kBatchMax) {
665  }
666  CHECK_ERROR_CODE(pimpl.get_record_for_write_batch(
667  context,
668  chunk,
669  &offset_batch[cur],
670  &record_batch[cur]));
671  cur += chunk;
672  }
673  return kErrorCodeOk;
674 }
If you want more than this, you should loop.
0 means no-error.
Definition: error_code.hpp:87
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Definition: error_code.hpp:155

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record_payload ( thread::Thread context,
ArrayOffset  offset,
const void **  payload 
)

Retrieves a pointer to the entire payload.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[out]payloadSets the pointer to the payload.
Precondition
offset < get_array_size()

This is used to retrieve entire record without copying. The record is protected by read-set (if there is any change, it will abort at pre-commit). However, we might read a half-changed value in the meantime.

Definition at line 82 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::get_record_payload().

85  {
86  return ArrayStoragePimpl(this).get_record_payload(context, offset, payload);
87 }

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::get_record_payload_batch ( thread::Thread context,
uint16_t  batch_size,
const ArrayOffset offset_batch,
const void **  payload_batch 
)

Definition at line 634 of file array_storage_pimpl.cpp.

References CHECK_ERROR_CODE, foedus::storage::array::ArrayStoragePimpl::get_record_payload_batch(), foedus::storage::array::ArrayStoragePimpl::kBatchMax, and foedus::kErrorCodeOk.

638  {
639  ArrayStoragePimpl pimpl(this);
640  for (uint16_t cur = 0; cur < batch_size;) {
641  uint16_t chunk = batch_size - cur;
642  if (chunk > ArrayStoragePimpl::kBatchMax) {
644  }
645  CHECK_ERROR_CODE(pimpl.get_record_payload_batch(
646  context,
647  chunk,
648  &offset_batch[cur],
649  &payload_batch[cur]));
650  cur += chunk;
651  }
652  return kErrorCodeOk;
653 }
If you want more than this, you should loop.
0 means no-error.
Definition: error_code.hpp:87
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Definition: error_code.hpp:155

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::get_record_primitive ( thread::Thread context,
ArrayOffset  offset,
T *  payload,
uint16_t  payload_offset 
)

Retrieves a part of record of the given offset as a primitive type in this array storage.

A bit more efficient than get_record().

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[out]payloadWe copy the record to this address.
[in]payload_offsetWe copy from this byte position of the record.
Template Parameters
Tprimitive type. All integers and floats are allowed.
Precondition
payload_offset + sizeof(T) <= get_payload_size()
offset < get_array_size()

Definition at line 77 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::get_record_primitive().

78  {
79  return ArrayStoragePimpl(this).get_record_primitive<T>(context, offset, payload, payload_offset);
80 }

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::get_record_primitive_batch ( thread::Thread context,
uint16_t  payload_offset,
uint16_t  batch_size,
const ArrayOffset offset_batch,
T *  payload 
)

batched interface

Definition at line 611 of file array_storage_pimpl.cpp.

References CHECK_ERROR_CODE, foedus::storage::array::ArrayStoragePimpl::get_record_primitive_batch(), foedus::storage::array::ArrayStoragePimpl::kBatchMax, and foedus::kErrorCodeOk.

616  {
617  ArrayStoragePimpl pimpl(this);
618  for (uint16_t cur = 0; cur < batch_size;) {
619  uint16_t chunk = batch_size - cur;
620  if (chunk > ArrayStoragePimpl::kBatchMax) {
622  }
623  CHECK_ERROR_CODE(pimpl.get_record_primitive_batch(
624  context,
625  payload_offset,
626  chunk,
627  &offset_batch[cur],
628  &payload_batch[cur]));
629  cur += chunk;
630  }
631  return kErrorCodeOk;
632 }
If you want more than this, you should loop.
0 means no-error.
Definition: error_code.hpp:87
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Definition: error_code.hpp:155

Here is the call graph for this function:

ErrorStack foedus::storage::array::ArrayStorage::hcc_reset_all_temperature_stat ( )

Resets all volatile pages' temperature stat to be zero in this storage.

Used only in HCC-branch.

Definition at line 964 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::hcc_reset_all_temperature_stat().

964  {
965  ArrayStoragePimpl pimpl(this);
966  return pimpl.hcc_reset_all_temperature_stat();
967 }

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::increment_record ( thread::Thread context,
ArrayOffset  offset,
T *  value,
uint16_t  payload_offset 
)

This one further optimizes overwrite_record_primitive() for the frequent use case of incrementing some data in primitive type.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[in,out]value(in) addendum, (out) value after addition.
[in]payload_offsetWe write to this byte position of the record.
Template Parameters
Tprimitive type. All integers and floats are allowed.
Precondition
payload_offset + sizeof(T) <= get_payload_size()
offset < get_array_size()

This method combines get and overwrite, so it can halve the number of tree lookup. This method can be only provided with template, so we omit "_primitive".

Definition at line 148 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::increment_record().

149  {
150  return ArrayStoragePimpl(this).increment_record<T>(context, offset, value, payload_offset);
151 }

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::increment_record_oneshot ( thread::Thread context,
ArrayOffset  offset,
value,
uint16_t  payload_offset 
)

This is a faster increment that does not return the value after increment.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[in]valueaddendum
[in]payload_offsetWe write to this byte position of the record.
Template Parameters
Tprimitive type. All integers and floats are allowed.
Precondition
payload_offset + sizeof(T) <= get_payload_size()
offset < get_array_size()

This method is faster than increment_record because it doesn't rely on the current value. This uses a rare "write-set only" log. other increments have to check deletion bit at least.

Definition at line 154 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::increment_record_oneshot().

158  {
159  return ArrayStoragePimpl(this).increment_record_oneshot<T>(
160  context,
161  offset,
162  value,
163  payload_offset);
164 }

Here is the call graph for this function:

ErrorStack foedus::storage::array::ArrayStorage::load ( const StorageControlBlock snapshot_block)

Definition at line 56 of file array_storage.cpp.

References foedus::storage::array::ArrayStoragePimpl::load().

56  {
57  return ArrayStoragePimpl(this).load(snapshot_block);
58 }

Here is the call graph for this function:

ArrayStorage & foedus::storage::array::ArrayStorage::operator= ( const ArrayStorage other)

Definition at line 47 of file array_storage.cpp.

References foedus::Attachable< ArrayStorageControlBlock >::control_block_, foedus::Attachable< CONTROL_BLOCK >::control_block_, foedus::Attachable< ArrayStorageControlBlock >::engine_, and foedus::Attachable< CONTROL_BLOCK >::engine_.

47  {
48  engine_ = other.engine_;
49  control_block_ = other.control_block_;
50  return *this;
51 }
Engine * engine_
Most attachable object stores an engine pointer (local engine), so we define it here.
Definition: attachable.hpp:107
ArrayStorageControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Definition: attachable.hpp:111
ErrorCode foedus::storage::array::ArrayStorage::overwrite_record ( thread::Thread context,
ArrayOffset  offset,
const void *  payload 
)
inline

Overwrites one record of the given offset in this array storage.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[in]payloadWe copy from this buffer. Must be at least get_payload_size().
Precondition
offset < get_array_size()

Equivalent to overwrite_record(context, offset, payload, 0, get_payload_size()).

Definition at line 198 of file array_storage.hpp.

References get_payload_size().

198  {
199  return overwrite_record(context, offset, payload, 0, get_payload_size());
200  }
uint16_t get_payload_size() const
Returns byte size of one record in this array storage without internal overheads. ...
ErrorCode overwrite_record(thread::Thread *context, ArrayOffset offset, const void *payload)
Overwrites one record of the given offset in this array storage.

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::overwrite_record ( thread::Thread context,
ArrayOffset  offset,
const void *  payload,
uint16_t  payload_offset,
uint16_t  payload_count 
)

Overwrites a part of one record of the given offset in this array storage.

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[in]payloadWe copy from this buffer. Must be at least get_payload_size().
[in]payload_offsetWe copy to this byte position of the record.
[in]payload_countHow many bytes we copy.
Precondition
payload_offset + payload_count <= get_payload_size()
offset < get_array_size()

Definition at line 96 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::overwrite_record().

97  {
98  return ArrayStoragePimpl(this).overwrite_record(
99  context,
100  offset,
101  payload,
102  payload_offset,
103  payload_count);
104 }

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::overwrite_record ( thread::Thread context,
ArrayOffset  offset,
Record record,
const void *  payload,
uint16_t  payload_offset,
uint16_t  payload_count 
)

Overwrites a part of the pre-searched record in this array storage.

Parameters
[in]contextThread context
[in]offsetThe offset in this array. Used for logging.
[in]recordPointer to the record.
[in]payloadWe copy from this buffer.
[in]payload_offsetWe copy to this byte position of the record.
[in]payload_countHow many bytes we copy.
Precondition
payload_offset + payload_count <= get_payload_size()
offset < get_array_size()
See also
get_record_for_write()

Definition at line 116 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::overwrite_record().

122  {
123  return ArrayStoragePimpl(this).overwrite_record(
124  context,
125  offset,
126  record,
127  payload,
128  payload_offset,
129  payload_count);
130 }

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::overwrite_record_primitive ( thread::Thread context,
ArrayOffset  offset,
payload,
uint16_t  payload_offset 
)

Overwrites a part of record of the given offset as a primitive type in this array storage.

A bit more efficient than overwrite_record().

Parameters
[in]contextThread context
[in]offsetThe offset in this array
[in]payloadThe value as primitive type.
[in]payload_offsetWe copy to this byte position of the record.
Template Parameters
Tprimitive type. All integers and floats are allowed.
Precondition
payload_offset + sizeof(T) <= get_payload_size()
offset < get_array_size()

Definition at line 107 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::overwrite_record_primitive().

108  {
109  return ArrayStoragePimpl(this).overwrite_record_primitive<T>(
110  context,
111  offset,
112  payload,
113  payload_offset);
114 }

Here is the call graph for this function:

template<typename T >
ErrorCode foedus::storage::array::ArrayStorage::overwrite_record_primitive ( thread::Thread context,
ArrayOffset  offset,
Record record,
payload,
uint16_t  payload_offset 
)

Overwrites a part of pre-searched record as a primitive type in this array storage.

A bit more efficient than overwrite_record().

Parameters
[in]contextThread context
[in]offsetThe offset in this array. Used for logging.
[in]recordPointer to the record.
[in]payloadThe value as primitive type.
[in]payload_offsetWe copy to this byte position of the record.
Template Parameters
Tprimitive type. All integers and floats are allowed.
Precondition
payload_offset + sizeof(T) <= get_payload_size()
offset < get_array_size()

Definition at line 133 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::overwrite_record_primitive().

138  {
139  return ArrayStoragePimpl(this).overwrite_record_primitive<T>(
140  context,
141  offset,
142  record,
143  payload,
144  payload_offset);
145 }

Here is the call graph for this function:

ErrorCode foedus::storage::array::ArrayStorage::prefetch_pages ( thread::Thread context,
bool  install_volatile,
bool  cache_snapshot,
ArrayOffset  from,
ArrayOffset  to 
)

Prefetch data pages in this storage.

Parameters
[in]contextThread context.
[in]install_volatileWhether to install/prefetch volatile pages based on the recent snapshot page if there is none.
[in]cache_snapshotWhether to cache/prefetch snapshot pages if exists.
[in]frominclusive begin offset of records that are specifically prefetched even in data pages.
[in]toexclusive end offset of records that are specifically prefetched even in data pages. 0 means up to the end of the storage.

This is to warmup the storage for the current core. Data pages are prefetched within from/to.

Definition at line 71 of file array_storage.cpp.

References get_array_size(), and foedus::storage::array::ArrayStoragePimpl::prefetch_pages().

76  {
77  if (to == 0) {
78  to = get_array_size();
79  }
80  return ArrayStoragePimpl(this).prefetch_pages(
81  context,
82  install_volatile,
83  cache_snapshot,
84  from,
85  to);
86 }
ArrayOffset get_array_size() const
Returns the size of this array.

Here is the call graph for this function:

ErrorStack foedus::storage::array::ArrayStorage::verify_single_thread ( thread::Thread context)

Definition at line 61 of file array_storage_pimpl.cpp.

References foedus::storage::array::ArrayStoragePimpl::verify_single_thread().

61  {
62  return ArrayStoragePimpl(this).verify_single_thread(context);
63 }

Here is the call graph for this function:

Friends And Related Function Documentation

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

Definition at line 60 of file array_storage.cpp.

60  {
61  o << "<ArrayStorage>"
62  << "<id>" << v.get_id() << "</id>"
63  << "<name>" << v.get_name() << "</name>"
64  << "<payload_size>" << v.get_payload_size() << "</payload_size>"
65  << "<array_size>" << v.get_array_size() << "</array_size>"
66  << "</ArrayStorage>";
67  return o;
68 }

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