libfoedus-core
FOEDUS Core Library
soc_manager.hpp
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  */
18 #ifndef FOEDUS_SOC_SOC_MANAGER_HPP_
19 #define FOEDUS_SOC_SOC_MANAGER_HPP_
20 
21 #include <vector>
22 
23 #include "foedus/fwd.hpp"
24 #include "foedus/initializable.hpp"
25 #include "foedus/module_type.hpp"
26 #include "foedus/proc/proc_id.hpp"
27 #include "foedus/soc/fwd.hpp"
28 
29 namespace foedus {
30 namespace soc {
60 class SocManager CXX11_FINAL : public virtual Initializable {
61  public:
62  friend class SocManagerPimpl;
63 
64  explicit SocManager(Engine* engine);
65  ~SocManager();
66 
67  // Disable default constructors
70  SocManager& operator=(const SocManager&) CXX11_FUNC_DELETE;
71 
73  bool is_initialized() const CXX11_OVERRIDE;
74  ErrorStack uninitialize() CXX11_OVERRIDE;
75 
78 
80  void* get_shared_user_memory() const;
85  uint64_t get_shared_user_memory_size() const;
86 
90  ErrorStack wait_for_master_module(bool init, ModuleType module);
95 
98 
117  static void trap_spawned_soc_main();
139  static void trap_spawned_soc_main(const std::vector< proc::ProcAndName >& procedures);
140 
141  private:
142  SocManagerPimpl *pimpl_;
143 };
144 } // namespace soc
145 } // namespace foedus
146 #endif // FOEDUS_SOC_SOC_MANAGER_HPP_
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
Definition: soc_manager.cpp:34
ErrorStack wait_for_children_module(bool init, ModuleType module)
Wait for other engines to finish init/uninit the module.
Definition: soc_manager.cpp:57
static void trap_spawned_soc_main()
This should be called at the beginning of main() if the executable expects to be spawned as SOC engin...
Definition: soc_manager.cpp:48
The pure-virtual interface to initialize/uninitialize non-trivial resources.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
Definition: soc_manager.cpp:36
Forward declarations of classes in root package.
void report_engine_fatal_error()
Announce fatal error state of this (either master or child) engine if possible.
Definition: soc_manager.cpp:64
STL namespace.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
ErrorStack wait_for_master_module(bool init, ModuleType module)
Wait for master engine to finish init/uninit the module.
Definition: soc_manager.cpp:61
ModuleType
Enumerates modules in FOEDUS engine.
Definition: module_type.hpp:26
uint64_t get_shared_user_memory_size() const
Definition: soc_manager.cpp:43
void * get_shared_user_memory() const
Shortcut for get_shared_memory_repo()->get_global_user_memory()
Definition: soc_manager.cpp:40
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
Typedefs of ID types used in procedure package.
std::pair< ProcName, Proc > ProcAndName
Just a std::pair.
Definition: proc_id.hpp:119
bool is_initialized() const override
Returns whether the object has been already initialized or not.
Definition: soc_manager.cpp:35
Repository of all shared memory in one FOEDUS instance.
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
Definition: cxx11.hpp:134
Forward declarations of classes in SOC package.
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Definition: cxx11.hpp:128
Pimpl object of SocManager.
SOC manager, which maintains the shared resource across SOCs and, if this engine is a master engine...
Definition: soc_manager.hpp:60
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
Definition: soc_manager.cpp:38