0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LogReplayBarrier.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #ifndef Hypertable_RangeServer_LogReplayBarrier_h
28 #define Hypertable_RangeServer_LogReplayBarrier_h
29 
32 
33 #include <AsyncComm/Clock.h>
34 
35 #include <condition_variable>
36 #include <memory>
37 #include <mutex>
38 
39 namespace Hypertable {
40 
43 
60  public:
61 
64  void set_root_complete();
65 
69  void set_metadata_complete();
70 
74  void set_system_complete();
75 
78  void set_user_complete();
79 
87  bool wait_for_root(ClockT::time_point deadline);
88 
97 
105  bool wait_for_system(ClockT::time_point deadline);
106 
114  bool wait_for_user(ClockT::time_point deadline);
115 
128  bool wait(ClockT::time_point deadline,
129  const TableIdentifier &table, const RangeSpec &range);
130 
141  bool wait(ClockT::time_point deadline,
142  const TableIdentifier &table);
143 
147  bool user_complete();
148 
149  private:
153  std::condition_variable m_root_complete_cond;
155  std::condition_variable m_metadata_complete_cond;
157  std::condition_variable m_system_complete_cond;
159  std::condition_variable m_user_complete_cond;
168  };
169 
171  typedef std::shared_ptr<LogReplayBarrier> LogReplayBarrierPtr;
172 
174 
175 } // namespace Hypertable
176 
177 #endif // Hypertable_RangeServer_LogReplayBarrier_h
bool wait_for_root(ClockT::time_point deadline)
Waits for ROOT commit log replay to complete.
bool m_user_complete
Flag indicating if USER commit log replay is complete.
static std::mutex mutex
Definition: Logger.cc:43
std::condition_variable m_root_complete_cond
Condition variable used to signal ROOT commit log replay complete.
Range specification.
Definition: RangeSpec.h:40
chrono::time_point< fast_clock > time_point
Definition: fast_clock.h:42
Declarations for TableIdentifier and TableIdentifierManaged.
void set_root_complete()
Signals ROOT commit log replay has been completed.
void set_user_complete()
Signals USER commit log replay has been completed.
Declaration of ClockT.
bool m_metadata_complete
Flag indicating if METADATA commit log replay is complete.
bool wait_for_user(ClockT::time_point deadline)
Waits for USER commit log replay to complete.
std::condition_variable m_system_complete_cond
Condition variable used to signal SYSTEM commit log replay complete.
std::mutex m_mutex
Mutex to serialize concurrent access.
std::shared_ptr< LogReplayBarrier > LogReplayBarrierPtr
Smart pointer to LogReplayBarrier.
Declarations for RangeSpec and RangeSpecManaged.
Hypertable definitions
bool wait_for_system(ClockT::time_point deadline)
Waits for SYSTEM commit log replay to complete.
void set_system_complete()
Signals SYSTEM commit log replay has been completed.
bool m_root_complete
Flag indicating if ROOT commit log replay is complete.
std::condition_variable m_metadata_complete_cond
Condition variable used to signal METADATA commit log replay complete.
void set_metadata_complete()
Signals METADATA commit log replay has been completed.
Blocks requests until specific commit log has finished replaying.
bool m_system_complete
Flag indicating if SYSTEM commit log replay is complete.
bool user_complete()
Checks if replay of USER commit log is complete.
bool wait(ClockT::time_point deadline, const TableIdentifier &table, const RangeSpec &range)
Waits for commit log replay to complete for range class defined by a given range. ...
std::condition_variable m_user_complete_cond
Condition variable used to signal USER commit log replay complete.
bool wait_for_metadata(ClockT::time_point deadline)
Waits for METADATA commit log replay to complete.