libfoedus-core
FOEDUS Core Library
soc_manager.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 <vector>
21 
23 
24 namespace foedus {
25 namespace soc {
26 SocManager::SocManager(Engine* engine) : pimpl_(nullptr) {
27  pimpl_ = new SocManagerPimpl(engine);
28 }
30  delete pimpl_;
31  pimpl_ = nullptr;
32 }
33 
35 bool SocManager::is_initialized() const { return pimpl_->is_initialized(); }
37 
39 
41  return pimpl_->memory_repo_.get_global_user_memory();
42 }
44  return pimpl_->engine_->get_options().soc_.shared_user_memory_size_kb_ * 1024ULL;
45 }
46 
47 
49  std::vector< proc::ProcAndName > procedures;
50  trap_spawned_soc_main(procedures);
51 }
52 
53 void SocManager::trap_spawned_soc_main(const std::vector< proc::ProcAndName >& procedures) {
55 }
56 
58  return pimpl_->wait_for_children_module(init, module);
59 }
60 
62  return pimpl_->wait_for_master_module(init, module);
63 }
65 
66 } // namespace soc
67 } // namespace foedus
friend class SocManagerPimpl
Definition: soc_manager.hpp:62
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
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
static void spawned_child_main(const std::vector< proc::ProcAndName > &procedures)
Main routine of spawned SOCs.
void report_engine_fatal_error()
Announce fatal error state of this (either master or child) engine if possible.
Definition: soc_manager.cpp:64
ErrorStack uninitialize() override final
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics...
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
const EngineOptions & get_options() const
Definition: engine.cpp:39
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
ErrorStack wait_for_children_module(bool init, ModuleType module)
ErrorStack initialize() override final
Typical implementation of Initializable::initialize() that provides initialize-once semantics...
ErrorStack wait_for_master_module(bool init, ModuleType module)
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
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.
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 arbit...
Definition: soc_options.hpp:60
bool is_initialized() const override final
Returns whether the object has been already initialized or not.
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
Definition: soc_manager.cpp:38