libfoedus-core
FOEDUS Core Library
log_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_LOG_LOG_MANAGER_HPP_
19 #define FOEDUS_LOG_LOG_MANAGER_HPP_
20 #include <stdint.h>
21 
22 #include "foedus/epoch.hpp"
23 #include "foedus/fwd.hpp"
24 #include "foedus/initializable.hpp"
25 #include "foedus/log/fwd.hpp"
26 #include "foedus/log/log_id.hpp"
28 #include "foedus/savepoint/fwd.hpp"
29 
30 namespace foedus {
31 namespace log {
36 class LogManager CXX11_FINAL : public virtual Initializable {
37  public:
38  explicit LogManager(Engine* engine);
39  ~LogManager();
40 
41  // Disable default constructors
45 
47  bool is_initialized() const CXX11_OVERRIDE;
49 
55  void copy_logger_states(savepoint::Savepoint *new_savepoint);
56 
65  void wakeup_loggers();
66 
70  LoggerRef get_logger(LoggerId logger_id);
71 
87 
103  ErrorCode wait_until_durable(Epoch commit_epoch, int64_t wait_microseconds = -1);
104 
112 
115 
116  private:
117  LogManagerPimpl *pimpl_;
118 };
119 } // namespace log
120 } // namespace foedus
121 #endif // FOEDUS_LOG_LOG_MANAGER_HPP_
LoggerRef get_logger(LoggerId logger_id)
Returns a reference to the logger of the given ID.
Definition: log_manager.cpp:49
LogManager & operator=(const LogManager &)=delete
MetaLogBuffer * get_meta_buffer()
Definition: log_manager.cpp:61
MetaLogger * get_meta_logger()
Definition: log_manager.cpp:65
void wakeup_loggers()
Wake up loggers if they are sleeping.
Definition: log_manager.cpp:35
The pure-virtual interface to initialize/uninitialize non-trivial resources.
Forward declarations of classes in log manager package.
Epoch get_durable_global_epoch_weak() const
Non-atomic version of the method.
Definition: log_manager.cpp:39
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
bool is_initialized() const override
Returns whether the object has been already initialized or not.
Definition: log_manager.cpp:32
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
Definition: log_manager.cpp:33
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Represents a time epoch.
Definition: epoch.hpp:61
The information we maintain in savepoint manager and externalize to a file.
Definition: savepoint.hpp:40
ErrorStack refresh_global_durable_epoch()
Called whenever there is a chance that the global durable epoch advances.
Definition: log_manager.cpp:54
Typedefs of ID types used in log package.
A log writer for metadata operation.
Pimpl object of LogManager.
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
Definition: log_manager.cpp:31
void copy_logger_states(savepoint::Savepoint *new_savepoint)
Fillup the given savepoint with the current information of the loggers.
Definition: log_manager.cpp:57
A view of Logger object for other SOCs and master engine.
Definition: logger_ref.hpp:35
A single log buffer for metadata (eg create/drop storage).
#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
Log Manager class that provides API to write/read transaction logs.
Definition: log_manager.hpp:36
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
Definition: cxx11.hpp:134
ErrorCode wait_until_durable(Epoch commit_epoch, int64_t wait_microseconds=-1)
Synchronously blocks until the durable global epoch reaches the given commit epoch or the given durat...
Definition: log_manager.cpp:46
Epoch get_durable_global_epoch() const
Returns the durable epoch of the entire engine.
Definition: log_manager.cpp:36
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Definition: cxx11.hpp:128
void announce_new_durable_global_epoch(Epoch new_epoch)
Sets the new global durable epoch and also wakes up threads that were waiting for it...
Definition: log_manager.cpp:42
Forward declarations of classes in savepoint manager package.
uint16_t LoggerId
Typedef for an ID of Logger.
Definition: log_id.hpp:36
ErrorCode
Enum of error codes defined in error_code.xmacro.
Definition: error_code.hpp:85