libfoedus-core
FOEDUS Core Library
|
Set of options for SOC manager. More...
Set of options for SOC manager.
This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.
Definition at line 38 of file soc_options.hpp.
#include <soc_options.hpp>
Public Types | |
enum | Constants { kDefaultSharedUserMemorySizeKb = 4 } |
Public Member Functions | |
SocOptions () | |
Constructs option values with default values. More... | |
std::string | convert_spawn_executable_pattern (int node) const |
converts spawn_executable_pattern_ into a string with the given node ID. More... | |
std::string | convert_spawn_ld_library_path_pattern (int node) const |
converts spawn_ld_library_path_pattern_ into a string with the given node ID. 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... | |
![]() | |
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 | |
EngineType | soc_type_ |
How to launch SOC engine instances. More... | |
uint64_t | shared_user_memory_size_kb_ |
As part of the global shared memory, we reserve this size of 'user memory' that can be used for arbitrary purporses by the user to communicate between SOCs. More... | |
fs::FixedPath | spawn_executable_pattern_ |
String pattern of path of executables to spawn SOC engines in each NUMA node. More... | |
fs::FixedPath | spawn_ld_library_path_pattern_ |
String pattern of LD_LIBRARY_PATH environment variable to spawn SOC engines in each NUMA node. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const SocOptions &v) |
Additional Inherited Members | |
![]() | |
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... | |
Enumerator | |
---|---|
kDefaultSharedUserMemorySizeKb |
default for shared_user_memory_size_kb_ |
Definition at line 39 of file soc_options.hpp.
foedus::soc::SocOptions::SocOptions | ( | ) |
Constructs option values with default values.
Definition at line 29 of file soc_options.cpp.
References foedus::kChildEmulated, kDefaultSharedUserMemorySizeKb, shared_user_memory_size_kb_, soc_type_, spawn_executable_pattern_, and spawn_ld_library_path_pattern_.
|
inlineoverridevirtual |
Polymorphic assign operator.
This should invoke operator= of the derived class.
[in] | other | assigned value. It must be dynamic-castable to the assignee class. |
Implements foedus::externalize::Externalizable.
Definition at line 92 of file soc_options.hpp.
std::string foedus::soc::SocOptions::convert_spawn_executable_pattern | ( | int | node | ) | const |
converts spawn_executable_pattern_ into a string with the given node ID.
Definition at line 36 of file soc_options.cpp.
References foedus::assorted::FixedString< MAXLEN, CHAR >::empty(), foedus::assorted::get_current_executable_path(), foedus::assorted::replace_all(), spawn_executable_pattern_, and foedus::assorted::FixedString< MAXLEN, CHAR >::str().
Referenced by foedus::soc::SocManagerPimpl::launch_spawned_children().
std::string foedus::soc::SocOptions::convert_spawn_ld_library_path_pattern | ( | int | node | ) | const |
converts spawn_ld_library_path_pattern_ into a string with the given node ID.
Definition at line 44 of file soc_options.cpp.
References foedus::assorted::FixedString< MAXLEN, CHAR >::empty(), foedus::assorted::replace_all(), spawn_ld_library_path_pattern_, and foedus::assorted::FixedString< MAXLEN, CHAR >::str().
Referenced by foedus::soc::SocManagerPimpl::launch_spawned_children().
|
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 92 of file soc_options.hpp.
|
overridevirtual |
Reads the content of this object from the given XML element.
[in] | element | the XML element that represents this object |
Expect errors due to missing-elements, out-of-range values, etc.
Implements foedus::externalize::Externalizable.
Definition at line 57 of file soc_options.cpp.
References EXTERNALIZE_LOAD_ELEMENT, EXTERNALIZE_LOAD_ENUM_ELEMENT, foedus::kRetOk, shared_user_memory_size_kb_, soc_type_, spawn_executable_pattern_, and spawn_ld_library_path_pattern_.
|
overridevirtual |
Writes the content of this object to the given XML element.
[in] | element | the 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 65 of file soc_options.cpp.
References CHECK_ERROR, EXTERNALIZE_SAVE_ELEMENT, EXTERNALIZE_SAVE_ENUM_ELEMENT, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, shared_user_memory_size_kb_, soc_type_, spawn_executable_pattern_, and spawn_ld_library_path_pattern_.
|
friend |
Definition at line 92 of file soc_options.hpp.
uint64_t foedus::soc::SocOptions::shared_user_memory_size_kb_ |
As part of the global shared memory, we reserve this size of 'user memory' that can be used for arbitrary purporses by the user to communicate between SOCs.
Definition at line 60 of file soc_options.hpp.
Referenced by foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), foedus::soc::SocManager::get_shared_user_memory_size(), load(), save(), and SocOptions().
EngineType foedus::soc::SocOptions::soc_type_ |
How to launch SOC engine instances.
The default value is kChildEmulated.
Definition at line 54 of file soc_options.hpp.
Referenced by foedus::proc::ProcManagerPimpl::emulated_register(), foedus::soc::SocManagerPimpl::initialize_master(), load(), foedus::proc::ProcManagerPimpl::pre_register(), save(), SocOptions(), foedus::soc::SocManagerPimpl::wait_for_child_attach(), foedus::soc::SocManagerPimpl::wait_for_child_terminate(), and foedus::soc::SocManagerPimpl::wait_for_children_module().
fs::FixedPath foedus::soc::SocOptions::spawn_executable_pattern_ |
String pattern of path of executables to spawn SOC engines in each NUMA node.
The default value is empty, which means we use the binary of the master ("/proc/self/exe"). If non-empty, we use the path to launch each SOC engine. A placeholder '$NODE$' is replaced with the NUMA node number. For example, "/foo/bar/node_$NODE$/my_exec becomes "/foo/bar/node_1/my_exec" on node-1. On the other hand, "/foo/bar/my_exec becomes "/foo/bar/my_exec" for all nodes. The main purpose of using different binaries for each SOC is 1) to manually achieve executable/library text replication on NUMA node, and 2) for kChildRemoteSpawned later.
If soc_type_ is not kChildLocalSpawned or kChildRemoteSpawned, this option is ignored.
Definition at line 75 of file soc_options.hpp.
Referenced by convert_spawn_executable_pattern(), load(), save(), and SocOptions().
fs::FixedPath foedus::soc::SocOptions::spawn_ld_library_path_pattern_ |
String pattern of LD_LIBRARY_PATH environment variable to spawn SOC engines in each NUMA node.
Similar to spawn_executable_pattern_. The default value is empty, which means we don't overwrite LD_LIBRARY_PATH of this master process. To overwrite master process's LD_LIBRARY_PATH with empty value, put one space etc.
Definition at line 85 of file soc_options.hpp.
Referenced by convert_spawn_ld_library_path_pattern(), load(), save(), and SocOptions().