Callback class for range server lock files. More...
#include <RangeServerHyperspaceCallback.h>
Public Member Functions | |
RangeServerHyperspaceCallback (ContextPtr &context, RangeServerConnectionPtr &rsc) | |
Constructor. More... | |
virtual void | lock_released () |
Responds to lock release event. More... | |
virtual void | lock_acquired (uint32_t mode) |
Responds to lock acquired event. More... | |
bool | wait_for_lock_acquisition (std::chrono::milliseconds max_wait) |
Waits for m_lock_held to become true. More... | |
Public Member Functions inherited from Hyperspace::HandleCallback | |
HandleCallback (uint32_t event_mask) | |
Constructor. More... | |
virtual void | attr_set (const std::string &name) |
Invoked when an attribute gets set on the file associated with the registered handle. More... | |
virtual void | attr_del (const std::string &name) |
Invoked when an attribute gets deleted from the file associated with the registered handle. More... | |
virtual void | child_node_added (const std::string &name) |
Invoked when a child node gets added to the directory associated with the registered handle. More... | |
virtual void | child_node_removed (const std::string &name) |
Invoked when an attribute gets deleted from the file associated with the registered handle. More... | |
int | get_event_mask () |
Returns the event mask of this callback object. More... | |
Private Attributes | |
std::mutex | m_mutex |
Mutex for serializing concurrent access More... | |
std::condition_variable | m_cond |
Condition variable used to wait for completion. More... | |
ContextPtr | m_context |
Master context More... | |
RangeServerConnectionPtr | m_rsc |
Range server connection More... | |
bool | m_lock_held |
Flag indicating if lock is currently held. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Hyperspace::HandleCallback | |
uint32_t | m_event_mask |
Callback class for range server lock files.
An object of this class is registered with each range server lock file in Hyperspace and is used to handle the disconnect and reconnect of a range server. It specifically takes measures to ensure that a range server does not get re-registered until it has received a lock released event for the server from Hyperspace.
Definition at line 57 of file RangeServerHyperspaceCallback.h.
|
inline |
Constructor.
Initializes object by passing Hyperspace::EVENT_MASK_LOCK_ACQUIRED and Hyperspace::EVENT_MASK_LOCK_RELEASED into the parent constructor.
context | Master context |
rsc | Range server connection object |
Definition at line 66 of file RangeServerHyperspaceCallback.h.
|
inlinevirtual |
Responds to lock acquired event.
This method will be called when the range server identified by m_rsc acquires the lock on its Hyperspace lock file. It sets m_lock_held to true and signals m_cond.
mode | the mode in which the lock was acquired |
Reimplemented from Hyperspace::HandleCallback.
Definition at line 113 of file RangeServerHyperspaceCallback.h.
|
inlinevirtual |
Responds to lock release event.
This method performs the following actions:
m_context->recovery_barrier_op
to Hypertable.Failover.GracePeriod
milliseconds in the future and then creates an OperationRecover for the server and adds it to the OperationProcessor.Reimplemented from Hyperspace::HandleCallback.
Definition at line 85 of file RangeServerHyperspaceCallback.h.
|
inline |
Waits for m_lock_held to become true.
This method waits on m_cond until m_lock_held becomes true.
deadline | Timeout if m_lock_held does not become true by this absolute time |
deadline
reached before m_lock_held becomes true, otherwise returns true Definition at line 127 of file RangeServerHyperspaceCallback.h.
|
private |
Condition variable used to wait for completion.
Definition at line 138 of file RangeServerHyperspaceCallback.h.
|
private |
Master context
Definition at line 141 of file RangeServerHyperspaceCallback.h.
|
private |
Flag indicating if lock is currently held.
Definition at line 147 of file RangeServerHyperspaceCallback.h.
|
private |
Mutex for serializing concurrent access
Definition at line 135 of file RangeServerHyperspaceCallback.h.
|
private |
Range server connection
Definition at line 144 of file RangeServerHyperspaceCallback.h.