libfoedus-core
FOEDUS Core Library
foedus::storage::StorageOptions Struct Referencefinal

Set of options for storage manager. More...

Detailed Description

Set of options for storage manager.

This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.

Definition at line 29 of file storage_options.hpp.

#include <storage_options.hpp>

Inheritance diagram for foedus::storage::StorageOptions:
Collaboration diagram for foedus::storage::StorageOptions:

Public Types

enum  Constants { kDefaultMaxStorages = 1 << 9, kDefaultPartitionerDataMemoryMb = 1, kDefaultHotThreshold = 256 }
 

Public Member Functions

 StorageOptions ()
 Constructs option values with default values. More...
 
ErrorStack load (tinyxml2::XMLElement *element) override
 Reads the content of this object from the given XML element. More...
 
ErrorStack save (tinyxml2::XMLElement *element) const override
 Writes the content of this object to the given XML element. More...
 
const char * get_tag_name () const override
 Returns an XML tag name for this object as a root element. More...
 
void assign (const foedus::externalize::Externalizable *other) override
 Polymorphic assign operator. More...
 
- Public Member Functions inherited from foedus::externalize::Externalizable
ErrorStack load_from_string (const std::string &xml)
 Load the content of this object from the given XML string. More...
 
void save_to_stream (std::ostream *ptr) const
 Invokes save() and directs the resulting XML text to the given stream. More...
 
ErrorStack load_from_file (const fs::Path &path)
 Load the content of this object from the specified XML file. More...
 
ErrorStack save_to_file (const fs::Path &path) const
 Atomically and durably writes out this object to the specified XML file. More...
 

Public Attributes

uint32_t max_storages_
 Maximum number of storages in this database. More...
 
uint32_t partitioner_data_memory_mb_
 Size in MB of a shared memory buffer allocated for all partitioners during log gleaning. More...
 
uint64_t hot_threshold_
 Page hotness >= this value will be considered hot (hybrid CC only). More...
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from foedus::externalize::Externalizable
static ErrorStack insert_comment (tinyxml2::XMLElement *element, const std::string &comment)
 
static ErrorStack append_comment (tinyxml2::XMLElement *parent, const std::string &comment)
 
static ErrorStack create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
 Only declaration in header. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value)
 vector version More...
 
template<typename ENUM >
static ErrorStack add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value)
 enum version More...
 
static ErrorStack add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child)
 child Externalizable version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0)
 Only declaration in header. More...
 
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="")
 string type is bit special. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >())
 
template<typename ENUM >
static ErrorStack get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0))
 enum version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false)
 vector version. More...
 
static ErrorStack get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false)
 child Externalizable version More...
 

Member Enumeration Documentation

Enumerator
kDefaultMaxStorages 
kDefaultPartitionerDataMemoryMb 
kDefaultHotThreshold 

Definition at line 30 of file storage_options.hpp.

Constructor & Destructor Documentation

foedus::storage::StorageOptions::StorageOptions ( )

Constructs option values with default values.

Definition at line 21 of file storage_options.cpp.

References hot_threshold_, kDefaultHotThreshold, kDefaultMaxStorages, kDefaultPartitionerDataMemoryMb, max_storages_, and partitioner_data_memory_mb_.

21  {
25 }
uint32_t max_storages_
Maximum number of storages in this database.
uint64_t hot_threshold_
Page hotness >= this value will be considered hot (hybrid CC only).
uint32_t partitioner_data_memory_mb_
Size in MB of a shared memory buffer allocated for all partitioners during log gleaning.

Member Function Documentation

void foedus::storage::StorageOptions::assign ( const foedus::externalize::Externalizable other)
inlineoverridevirtual

Polymorphic assign operator.

This should invoke operator= of the derived class.

Parameters
[in]otherassigned value. It must be dynamic-castable to the assignee class.

Implements foedus::externalize::Externalizable.

Definition at line 58 of file storage_options.hpp.

const char* foedus::storage::StorageOptions::get_tag_name ( ) const
inlineoverridevirtual

Returns an XML tag name for this object as a root element.

We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.

Implements foedus::externalize::Externalizable.

Definition at line 58 of file storage_options.hpp.

ErrorStack foedus::storage::StorageOptions::load ( tinyxml2::XMLElement *  element)
overridevirtual

Reads the content of this object from the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect errors due to missing-elements, out-of-range values, etc.

Implements foedus::externalize::Externalizable.

Definition at line 26 of file storage_options.cpp.

References EXTERNALIZE_LOAD_ELEMENT, hot_threshold_, foedus::kRetOk, max_storages_, and partitioner_data_memory_mb_.

26  {
30  return kRetOk;
31 }
#define EXTERNALIZE_LOAD_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
uint32_t max_storages_
Maximum number of storages in this database.
uint64_t hot_threshold_
Page hotness >= this value will be considered hot (hybrid CC only).
uint32_t partitioner_data_memory_mb_
Size in MB of a shared memory buffer allocated for all partitioners during log gleaning.
const ErrorStack kRetOk
Normal return value for no-error case.
ErrorStack foedus::storage::StorageOptions::save ( tinyxml2::XMLElement *  element) const
overridevirtual

Writes the content of this object to the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.

Implements foedus::externalize::Externalizable.

Definition at line 32 of file storage_options.cpp.

References CHECK_ERROR, EXTERNALIZE_SAVE_ELEMENT, hot_threshold_, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, max_storages_, and partitioner_data_memory_mb_.

32  {
33  CHECK_ERROR(insert_comment(element, "Set of options for storage manager."));
35  "Maximum number of storages in this database.");
37  "Size in MB of a shared memory buffer allocated for all partitioners during log gleaning."
38  "Increase this value when you have a large number of storages that have large partitioning"
39  " information (eg. long keys).");
41  "Hot record threshold; for HCC only.");
42  return kRetOk;
43 }
static ErrorStack insert_comment(tinyxml2::XMLElement *element, const std::string &comment)
uint32_t max_storages_
Maximum number of storages in this database.
uint64_t hot_threshold_
Page hotness >= this value will be considered hot (hybrid CC only).
uint32_t partitioner_data_memory_mb_
Size in MB of a shared memory buffer allocated for all partitioners during log gleaning.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
#define EXTERNALIZE_SAVE_ELEMENT(element, attribute, comment)
Adds an xml element to represent a member variable of this object.

Here is the call graph for this function:

Friends And Related Function Documentation

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

Definition at line 58 of file storage_options.hpp.

Member Data Documentation

uint64_t foedus::storage::StorageOptions::hot_threshold_

Page hotness >= this value will be considered hot (hybrid CC only).

Definition at line 56 of file storage_options.hpp.

Referenced by foedus::thread::ThreadPimpl::handle_tasks(), foedus::xct::Xct::initialize(), load(), save(), and StorageOptions().

uint32_t foedus::storage::StorageOptions::partitioner_data_memory_mb_

Size in MB of a shared memory buffer allocated for all partitioners during log gleaning.

Increase this value when you have a large number of storages that have large partitioning information (eg. long keys). So far, this must be less than 4GB.

Definition at line 51 of file storage_options.hpp.

Referenced by foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), foedus::storage::hash::HashStoragePimpl::create(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), load(), foedus::storage::PartitionerMetadata::locate_data(), save(), and StorageOptions().


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