libfoedus-core
FOEDUS Core Library
storage_manager_pimpl.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_STORAGE_STORAGE_MANAGER_PIMPL_HPP_
19 #define FOEDUS_STORAGE_STORAGE_MANAGER_PIMPL_HPP_
20 #include <map>
21 #include <mutex>
22 #include <string>
23 #include <vector>
24 
25 #include "foedus/fwd.hpp"
26 #include "foedus/initializable.hpp"
28 #include "foedus/snapshot/fwd.hpp"
31 #include "foedus/storage/fwd.hpp"
35 #include "foedus/thread/fwd.hpp"
36 
37 namespace foedus {
38 namespace storage {
41  // this is backed by shared memory. not instantiation. just reinterpret_cast.
42  StorageManagerControlBlock() = delete;
43  ~StorageManagerControlBlock() = delete;
44 
45  void initialize() {
47  }
48  void uninitialize() {
50  }
51 
58 
64 };
65 
74  public:
75  StorageManagerPimpl() = delete;
76  explicit StorageManagerPimpl(Engine* engine) : engine_(engine) {}
77  ErrorStack initialize_once() override;
79  ErrorStack uninitialize_once() override;
80 
91 
95  bool exists(const StorageName& name);
96 
97  ErrorStack drop_storage(StorageId id, Epoch *commit_epoch);
99  ErrorStack create_storage(Metadata *metadata, Epoch *commit_epoch);
100  void create_storage_apply(const Metadata& metadata);
101  template <typename STORAGE>
102  ErrorStack create_storage_and_log(const Metadata* meta, Epoch *commit_epoch);
103 
109 
111  StorageId storage_id,
112  xct::RwLockableXctId* old_address,
113  xct::WriteXctAccess *write);
115 
116  uint32_t get_max_storages() const;
117 
118  Engine* const engine_;
119 
121 
129 
136 };
137 
138 static_assert(
140  "StorageManagerControlBlock is too large.");
141 } // namespace storage
142 } // namespace foedus
143 #endif // FOEDUS_STORAGE_STORAGE_MANAGER_PIMPL_HPP_
StorageControlBlock * storages_
Storage instances (pimpl objects) are allocated in this shared memory.
Represents the data in one snapshot metadata file.
ErrorStack drop_storage(StorageId id, Epoch *commit_epoch)
Definitions of IDs in this package and a few related constant values.
uint32_t StorageId
Unique ID for storage.
Definition: storage_id.hpp:55
void initialize(bool recursive=false)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Represents a record of write-access during a transaction.
Definition: xct_access.hpp:168
ErrorStack reinitialize_for_recovered_snapshot()
Special method called only from recovery manager.
Result of track_moved_record().
Definition: xct_id.hpp:1180
StorageManagerControlBlock * control_block_
Forward declarations of classes in root package.
Shared data in StorageManagerPimpl.
StorageId largest_storage_id_
The largest StorageId we so far observed.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
xct::TrackMovedRecordResult track_moved_record(StorageId storage_id, xct::RwLockableXctId *old_address, xct::WriteXctAccess *write)
Forward declarations of classes in snapshot manager package.
Represents a time epoch.
Definition: epoch.hpp:61
Typical implementation of Initializable as a skeleton base class.
ErrorStack create_storage_and_log(const Metadata *meta, Epoch *commit_epoch)
A mutex that can be placed in shared memory and used from multiple processes.
The MCS reader-writer lock variant of LockableXctId.
Definition: xct_id.hpp:1132
Metadata of one storage.
Definition: metadata.hpp:58
Forward declarations of classes in storage package.
StorageControlBlock * get_storage(StorageId id)
void create_storage_apply(const Metadata &metadata)
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
soc::SharedMutex mod_lock_
In case there are multiple threads that add/delete/expand storages, those threads take this lock...
Pimpl object of StorageManager.
ErrorStack hcc_reset_all_temperature_stat(StorageId storage_id)
Resets all volatile pages' temperature stat to be zero in the specified storage.
storage::StorageId * storage_name_sort_
This shared memory stores the ID of storages sorted by their names.
Forward declarations of classes in thread package.
A base layout of shared data for all storage types.
Definition: storage.hpp:53
ErrorStack clone_all_storage_metadata(snapshot::SnapshotMetadata *metadata)
ErrorStack create_storage(Metadata *metadata, Epoch *commit_epoch)