|
cluck 1.0.1
The cluster lock service.
|
Handle messages from the communicatord. More...
#include <messenger.h>


Public Types | |
| typedef std::shared_ptr< messenger > | pointer_t |
Public Member Functions | |
| messenger (cluckd *c, advgetopt::getopt &opts) | |
| The messenger initialization. | |
| messenger (messenger const &)=delete | |
| virtual | ~messenger () override |
| void | finish_parsing () |
| Finish handling command line options. | |
| virtual void | fluid_settings_changed (fluid_settings::fluid_settings_status_t status, std::string const &name, std::string const &value) override |
| Send the CLUSTER_STATUS to communicatord once ready. | |
| messenger & | operator= (messenger const &)=delete |
| virtual void | ready (ed::message &msg) |
| Messenger received the READY message. | |
| virtual void | stop (bool quitting) |
| Let the server know STOP or QUITTING was sent to us. | |
Private Attributes | |
| cluckd * | f_cluckd = nullptr |
This class is an implementation of the TCP client message connection so we can handle incoming messages. We actually use the fluid-settings which itself uses the communicatord connection. All of the basic communication messages used by the communicatord and fluid settings are handled automatically.
This class handles the lock messages.
Definition at line 34 of file messenger.h.
| typedef std::shared_ptr<messenger> cluck_daemon::messenger::pointer_t |
Definition at line 38 of file messenger.h.
| cluck_daemon::messenger::messenger | ( | cluckd * | c, |
| advgetopt::getopt & | opts | ||
| ) |
The messenger is the cluck daemon connection to the communicator server.
It sets up its dispatcher and calls cluckd functions whenever it receives a message.
| [in] | c | The cluck object we are listening for. |
| [in] | opts | The options received from the command line. |
Definition at line 76 of file messenger.cpp.
References cluck_daemon::cluckd::msg_absolutely(), cluck_daemon::cluckd::msg_activate_lock(), cluck_daemon::cluckd::msg_add_ticket(), cluck_daemon::cluckd::msg_clock_stable(), cluck_daemon::cluckd::msg_cluster_down(), cluck_daemon::cluckd::msg_cluster_up(), cluck_daemon::cluckd::msg_drop_ticket(), cluck_daemon::cluckd::msg_get_max_ticket(), cluck_daemon::cluckd::msg_info(), cluck_daemon::cluckd::msg_list_tickets(), cluck_daemon::cluckd::msg_lock(), cluck_daemon::cluckd::msg_lock_activated(), cluck_daemon::cluckd::msg_lock_entered(), cluck_daemon::cluckd::msg_lock_entering(), cluck_daemon::cluckd::msg_lock_exiting(), cluck_daemon::cluckd::msg_lock_failed(), cluck_daemon::cluckd::msg_lock_leaders(), cluck_daemon::cluckd::msg_lock_started(), cluck_daemon::cluckd::msg_lock_status(), cluck_daemon::cluckd::msg_lock_tickets(), cluck_daemon::cluckd::msg_max_ticket(), cluck_daemon::cluckd::msg_server_gone(), cluck_daemon::cluckd::msg_status(), cluck_daemon::cluckd::msg_ticket_added(), cluck_daemon::cluckd::msg_ticket_ready(), and cluck_daemon::cluckd::msg_unlock().
|
delete |
|
overridevirtual |
Definition at line 204 of file messenger.cpp.
| void cluck_daemon::messenger::finish_parsing | ( | ) |
This function makes sure the fluid settings and communicator daemon have a chance to check the command line options and act on it.
Definition at line 214 of file messenger.cpp.
|
overridevirtual |
This function builds a message and sends it to communicatord.
The CLUSTER_UP and CLUSTER_DOWN messages are sent only when that specific event happen and until then we do not know what the state really is (although we assume the worst and use CLUSTER_DOWN until we get a reply).
| [in] | status | The status of the fluid settings object. |
| [in] | name | The name of the changing parameter. |
| [in] | value | The value of the parameter. |
Definition at line 278 of file messenger.cpp.
|
virtual |
Whenever we receive the READY message, we also receive our IP address as the "my_address" parameter. This gets copied in the cluckd object.
The function tells the fluid settings connection that the daemon is ready.
The cluck daemon uses the wall clock to synchronize the locks between servers so it requests the clock status from the communicator daemon. Once known to be stable, it's ready to start accepting locks.
| [in,out] | msg | The READY message. |
Definition at line 235 of file messenger.cpp.
References f_cluckd, and cluck_daemon::cluckd::set_my_ip_address().
|
virtual |
This STOP and QUITTING messages are currently managed through this overridden virtual function.
| [in] | quitting | Whether STOP (false) or QUITTING (true) was received. |
Definition at line 260 of file messenger.cpp.
References f_cluckd, and cluck_daemon::cluckd::stop().
|
private |
Definition at line 59 of file messenger.h.
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.