22 #ifndef Hypertable_Master_RecoveryStepFuture_h
23 #define Hypertable_Master_RecoveryStepFuture_h
28 #include <boost/thread/condition.hpp>
30 #include <condition_variable>
45 typedef std::map<String, std::pair<int32_t, String> >
ErrorMapT;
52 std::lock_guard<std::mutex> lock(
m_mutex);
54 locations.erase(location);
61 std::lock_guard<std::mutex> lock(
m_mutex);
67 std::lock_guard<std::mutex> lock(
m_mutex);
79 ErrorMapT::iterator iter =
m_error_map.find(location);
88 int32_t error,
const String &message) {
89 std::lock_guard<std::mutex> lock(
m_mutex);
92 HT_INFOF(
"Ignoring response from %s for recovery step %s because "
93 "response plan generation %d does not match registered (%d)",
94 location.c_str(),
m_label.c_str(), plan_generation,
110 std::unique_lock<std::mutex> lock(
m_mutex);
111 ErrorMapT::iterator iter;
113 auto expire_time = std::chrono::system_clock::now() +
114 std::chrono::milliseconds(initial_timeout);
118 if (
m_cond.wait_until(lock, expire_time) == std::cv_status::timeout) {
125 m_outstanding.clear();
129 expire_time = std::chrono::system_clock::now() +
130 std::chrono::milliseconds(initial_timeout);
138 std::lock_guard<std::mutex> lock(
m_mutex);
156 #endif // Hypertable_Master_RecoveryStepFuture_h
std::set< String > StringSet
STL Set managing Strings.
RecoveryStepFuture(const String &label, int plan_generation)
std::string String
A String is simply a typedef to std::string.
void register_locations(StringSet &locations)
std::map< String, std::pair< int32_t, String > > ErrorMapT
void status(const String &location, int plan_generation)
std::shared_ptr< RecoveryStepFuture > RecoveryStepFuturePtr
A timer class to keep timeout states across AsyncComm related calls.
Tracks outstanding RangeServer recover requests.
Time related declarations.
#define HT_INFOF(msg,...)
void success(const String &location, int plan_generation)
bool wait_for_completion(uint32_t initial_timeout)
std::condition_variable m_cond
void get_error_map(ErrorMapT &error_map)
void failure(const String &location, int plan_generation, int32_t error, const String &message)