libfoedus-core
FOEDUS Core Library
logger_ref.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_LOGGER_REF_HPP_
19 #define FOEDUS_LOG_LOGGER_REF_HPP_
20 
21 #include "foedus/attachable.hpp"
22 #include "foedus/epoch.hpp"
23 #include "foedus/fwd.hpp"
24 #include "foedus/log/fwd.hpp"
25 #include "foedus/log/log_id.hpp"
26 #include "foedus/savepoint/fwd.hpp"
27 
28 namespace foedus {
29 namespace log {
30 
35 class LoggerRef : public Attachable<LoggerControlBlock> {
36  public:
37  LoggerRef();
38  LoggerRef(
39  Engine* engine,
40  LoggerControlBlock* block,
41  LoggerId id,
42  uint16_t numa_node,
43  uint16_t in_node_ordinal);
44 
46  Epoch get_durable_epoch() const;
47 
51  void wakeup();
52 
59  void wakeup_for_durable_epoch(Epoch desired_durable_epoch);
60 
62  void copy_logger_state(savepoint::Savepoint *new_savepoint) const;
63 
65  void add_epoch_history(const EpochMarkerLogType& epoch_marker);
66 
80  LogRange get_log_range(Epoch prev_epoch, Epoch until_epoch);
81 
82  protected:
84  uint16_t numa_node_;
85  uint16_t in_node_ordinal_;
86 };
87 
88 } // namespace log
89 } // namespace foedus
90 #endif // FOEDUS_LOG_LOGGER_REF_HPP_
void copy_logger_state(savepoint::Savepoint *new_savepoint) const
Called from log manager's copy_logger_states.
Definition: logger_ref.cpp:56
Forward declarations of classes in log manager package.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
a contiguous range of log entries that might span multiple files.
Definition: log_id.hpp:52
Forward declarations of classes in root package.
Represents a time epoch.
Definition: epoch.hpp:61
The information we maintain in savepoint manager and externalize to a file.
Definition: savepoint.hpp:40
Typedefs of ID types used in log package.
A view of Logger object for other SOCs and master engine.
Definition: logger_ref.hpp:35
LogRange get_log_range(Epoch prev_epoch, Epoch until_epoch)
Constructs the range of log entries that represent the given epoch ranges.
Definition: logger_ref.cpp:91
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
A log type to declare a switch of epoch in a logger or the engine.
Epoch get_durable_epoch() const
Returns this logger's durable epoch.
Definition: logger_ref.cpp:41
void wakeup_for_durable_epoch(Epoch desired_durable_epoch)
Wakes up this logger if its durable_epoch has not reached the given epoch yet.
Definition: logger_ref.cpp:45
void wakeup()
Wakes up this logger if it is sleeping.
Definition: logger_ref.cpp:52
Attachable Resources on Shared Memory.
Definition: attachable.hpp:58
Shared data of Logger.
Definition: logger_impl.hpp:51
Forward declarations of classes in savepoint manager package.
void add_epoch_history(const EpochMarkerLogType &epoch_marker)
Append a new epoch history.
Definition: logger_ref.cpp:65
uint16_t LoggerId
Typedef for an ID of Logger.
Definition: log_id.hpp:36