libfoedus-core
FOEDUS Core Library
proc_options.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
19 
20 #include <cstdlib>
21 #include <sstream>
22 #include <string>
23 
26 
27 namespace foedus {
28 namespace proc {
33 }
34 
36  return assorted::replace_all(shared_library_path_pattern_.str(), "$NODE$", node);
37 }
38 
40  return assorted::replace_all(shared_library_dir_pattern_.str(), "$NODE$", node);
41 }
42 
43 ErrorStack ProcOptions::load(tinyxml2::XMLElement* element) {
47  return kRetOk;
48 }
49 
50 ErrorStack ProcOptions::save(tinyxml2::XMLElement* element) const {
51  CHECK_ERROR(insert_comment(element, "Set of options for loading system/user procedures"));
52 
53  EXTERNALIZE_SAVE_ELEMENT(element, max_proc_count_, "Maximum number of system/user procedures.");
55  "String pattern of ';'-separated path of shared libraries to load in each NUMA node.\n"
56  " The default value is empty, which means we don't load any shared libraries.\n"
57  " If non-empty, we load the shared libraries of the path to register user-defined procedures.\n"
58  " A placeholder '$NODE$' is replaced with the NUMA node number.");
59  EXTERNALIZE_SAVE_ELEMENT(element, shared_library_dir_pattern_, "String pattern of "
60  "';'-separated path of directories that contain shared libaries to load.\n"
61  " Similar to shared_library_path_pattern_. The difference is that all '.so' files under"
62  " the directory is loaded. The default value is empty.");
63  return kRetOk;
64 }
65 
66 } // namespace proc
67 } // namespace foedus
#define EXTERNALIZE_LOAD_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
ErrorStack save(tinyxml2::XMLElement *element) const override
Writes the content of this object to the given XML element.
Default value for max_proc_count_.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
ProcOptions()
Constructs option values with default values.
static ErrorStack insert_comment(tinyxml2::XMLElement *element, const std::string &comment)
fs::FixedPath shared_library_dir_pattern_
String pattern of ';'-separated path of directories that contain shared libaries to load...
ErrorStack load(tinyxml2::XMLElement *element) override
Reads the content of this object from the given XML element.
std::string replace_all(const std::string &target, const std::string &search, const std::string &replacement)
target.replaceAll(search, replacement).
std::string convert_shared_library_dir_pattern(int node) const
converts shared_library_dir_pattern_ into a string with the given node ID.
fs::FixedPath shared_library_path_pattern_
String pattern of ';'-separated path of shared libraries to load in each NUMA node.
std::basic_string< CHAR > str() const
Convert to a std::string object.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
std::string convert_shared_library_path_pattern(int node) const
converts shared_library_path_pattern_ into a string with the given node ID.
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.
uint32_t max_proc_count_
Maximum number of system/user procedures.