libfoedus-core
FOEDUS Core Library
|
Set of options for loading system/user procedures. More...
Set of options for loading system/user procedures.
This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.
Definition at line 38 of file proc_options.hpp.
#include <proc_options.hpp>
Public Types | |
enum | Constants { kDefaultMaxProcCount = 1 << 16 } |
Public Member Functions | |
ProcOptions () | |
Constructs option values with default values. More... | |
std::string | convert_shared_library_path_pattern (int node) const |
converts shared_library_path_pattern_ into a string with the given node ID. More... | |
std::string | convert_shared_library_dir_pattern (int node) const |
converts shared_library_dir_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 | |
uint32_t | max_proc_count_ |
Maximum number of system/user procedures. More... | |
fs::FixedPath | shared_library_path_pattern_ |
String pattern of ';'-separated path of shared libraries to load in each NUMA node. More... | |
fs::FixedPath | shared_library_dir_pattern_ |
String pattern of ';'-separated path of directories that contain shared libaries to load. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const ProcOptions &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 | |
---|---|
kDefaultMaxProcCount |
Default value for max_proc_count_. |
Definition at line 39 of file proc_options.hpp.
foedus::proc::ProcOptions::ProcOptions | ( | ) |
Constructs option values with default values.
Definition at line 29 of file proc_options.cpp.
References kDefaultMaxProcCount, max_proc_count_, shared_library_dir_pattern_, and shared_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 78 of file proc_options.hpp.
std::string foedus::proc::ProcOptions::convert_shared_library_dir_pattern | ( | int | node | ) | const |
converts shared_library_dir_pattern_ into a string with the given node ID.
Definition at line 39 of file proc_options.cpp.
References foedus::assorted::replace_all(), shared_library_dir_pattern_, and foedus::assorted::FixedString< MAXLEN, CHAR >::str().
std::string foedus::proc::ProcOptions::convert_shared_library_path_pattern | ( | int | node | ) | const |
converts shared_library_path_pattern_ into a string with the given node ID.
Definition at line 35 of file proc_options.cpp.
References foedus::assorted::replace_all(), shared_library_path_pattern_, and foedus::assorted::FixedString< MAXLEN, CHAR >::str().
|
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 78 of file proc_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 43 of file proc_options.cpp.
References EXTERNALIZE_LOAD_ELEMENT, foedus::kRetOk, max_proc_count_, shared_library_dir_pattern_, and shared_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 50 of file proc_options.cpp.
References CHECK_ERROR, EXTERNALIZE_SAVE_ELEMENT, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, max_proc_count_, shared_library_dir_pattern_, and shared_library_path_pattern_.
|
friend |
Definition at line 78 of file proc_options.hpp.
uint32_t foedus::proc::ProcOptions::max_proc_count_ |
Maximum number of system/user procedures.
Definition at line 49 of file proc_options.hpp.
Referenced by foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), load(), ProcOptions(), and save().
fs::FixedPath foedus::proc::ProcOptions::shared_library_dir_pattern_ |
String pattern of ';'-separated path of directories that contain shared libaries to load.
Similar to shared_library_path_pattern_. The difference is that all ".so" files under the directory is loaded. The default value is empty.
Definition at line 71 of file proc_options.hpp.
Referenced by convert_shared_library_dir_pattern(), load(), ProcOptions(), and save().
fs::FixedPath foedus::proc::ProcOptions::shared_library_path_pattern_ |
String pattern of ';'-separated path of shared libraries to load in each NUMA node.
The default value is empty, which means we don't load any shared libraries. If non-empty, we load the shared libraries of the path to register user-defined procedures. A placeholder '$NODE$' is replaced with the NUMA node number. For example, "/foo/bar/node_$NODE$/mylib.so becomes "/foo/bar/node_1/mylib.so" on node-1. On the other hand, "/foo/bar/mylib.so becomes "/foo/bar/mylib.so" for all nodes. The main purpose of using different binaries for each node is 1) to manually achieve executable/library text replication on NUMA node, and 2) for kChildRemoteSpawned later.
Definition at line 62 of file proc_options.hpp.
Referenced by convert_shared_library_path_pattern(), load(), ProcOptions(), and save().