|
cluck 1.0.1
The cluster lock service.
|
Functions | |
| void | msg_lock_status (ed::message &msg, typename ed::dispatcher_match::execute_callback_t callback) |
| Setup the lock status. | |
| void | msg_ready (ed::message &msg, ed::connection_with_send_message::weak_t messenger) |
| Also register for the READY message. | |
Variables | |
| bool | g_lock_ready = false |
| Record the current status of the cluck daemon. | |
| void cluck::anonymous_namespace{cluck_status.cpp}::msg_lock_status | ( | ed::message & | msg, |
| typename ed::dispatcher_match::execute_callback_t | callback | ||
| ) |
This callback function is called whenever the status of the local cluck daemon changes from accepting to not accepting locks.
The function updates the g_lock_ready flag according to the command found in the msg parameter.
The callback, if not null, gets called with the msg parameter. This gives the user the ability to react immediately when the status of the cluck daemon changes. In some cases, the reaction is to mark the client service as itself being ready. The current status can be checked from within the callback by calling the is_lock_ready() function.
| [in] | msg | The message being processed. |
| [in] | callback | The user callback. |
Definition at line 160 of file cluck_status.cpp.
References g_lock_ready, and msg_lock_status().
Referenced by msg_lock_status().
| void cluck::anonymous_namespace{cluck_status.cpp}::msg_ready | ( | ed::message & | msg, |
| ed::connection_with_send_message::weak_t | messenger | ||
| ) |
This function gets called whenever the client receives the READY message. It sends a LOCK_STATUS message to cluck to get the current status of the cluck service.
| [in] | msg | The READY message. |
| [in] | messenger | The messenger used to send the LOCK_STATUS message. |
Definition at line 115 of file cluck_status.cpp.
References msg_ready().
Referenced by msg_ready().
| bool cluck::anonymous_namespace{cluck_status.cpp}::g_lock_ready = false |
The cluck deamon always makes sure that it is up and running. If something goes awry (i.e. a leader computer goes down), then it sends a NO_LOCK message to all the local services.
When everything is ready to send LOCK messages and actually obtain such locks, the cluck daemon sends a LOCK_READY message.
The g_lock_ready variable is set to true when the client receives the LOCK_READY and to false when the client receives NO_LOCK. This allows us to have the is_lock_ready() function returning the correct status of the cluck daemon.
Definition at line 103 of file cluck_status.cpp.
Referenced by msg_lock_status().
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.