|
cluck 1.0.1
The cluster lock service.
|
Namespaces | |
| namespace | anonymous_namespace{cluck.cpp} |
| namespace | anonymous_namespace{cluck_status.cpp} |
Classes | |
| class | cluck |
| Cluster lock. More... | |
Typedefs | |
| typedef snapdev::timespec_ex | timeout_t |
| A timeout delay. | |
Enumerations | |
| enum class | mode_t { CLUCK_MODE_SIMPLE , CLUCK_MODE_EXTENDED } |
| enum class | reason_t { CLUCK_REASON_NONE , CLUCK_REASON_LOCAL_TIMEOUT , CLUCK_REASON_REMOTE_TIMEOUT , CLUCK_REASON_DEADLOCK , CLUCK_REASON_TRANSMISSION_ERROR , CLUCK_REASON_INVALID } |
| enum class | state_t { CLUCK_STATE_IDLE , CLUCK_STATE_LOCKING , CLUCK_STATE_LOCKED , CLUCK_STATE_UNLOCKING , CLUCK_STATE_FAILED } |
| enum class | type_t { CLUCK_TYPE_READ_WRITE , CLUCK_TYPE_READ_ONLY , CLUCK_TYPE_READ_WRITE_PRIORITY } |
Functions | |
| DECLARE_EXCEPTION (cluck_exception, busy) | |
| DECLARE_EXCEPTION (cluck_exception, invalid_message) | |
| DECLARE_EXCEPTION (cluck_exception, invalid_parameter) | |
| DECLARE_EXCEPTION (cluck_exception, timeout) | |
| DECLARE_LOGIC_ERROR (logic_error) | |
| DECLARE_LOGIC_ERROR (unexpected_case) | |
| DECLARE_MAIN_EXCEPTION (cluck_exception) | |
| DECLARE_OUT_OF_RANGE (out_of_range) | |
| timeout_t | get_lock_duration_timeout () |
| timeout_t | get_lock_obtention_timeout () |
| int | get_major_version () |
| Get the major version of the library. | |
| int | get_patch_version () |
| Get the patch version of the library. | |
| int | get_release_version () |
| Get the minor version of the library. | |
| timeout_t | get_unlock_timeout () |
| char const * | get_version_string () |
| Get the full version of the library as a string. | |
| bool | is_lock_ready () |
| Check the current status of the cluck daemon. | |
| void | listen_to_cluck_status (ed::connection_with_send_message::pointer_t messenger, ed::dispatcher::pointer_t dispatcher, typename ed::dispatcher_match::execute_callback_t callback) |
| Start listening to changes in the cluck status. | |
| void | set_lock_duration_timeout (timeout_t timeout) |
| void | set_lock_obtention_timeout (timeout_t timeout) |
| void | set_unlock_timeout (timeout_t timeout) |
Variables | |
| timeout_t | CLUCK_DEFAULT_TIMEOUT = timeout_t(-1, 0) |
| timeout_t | CLUCK_LOCK_DURATION_DEFAULT_TIMEOUT = timeout_t(5, 0) |
| timeout_t | CLUCK_LOCK_OBTENTION_DEFAULT_TIMEOUT = timeout_t(5, 0) |
| timeout_t | CLUCK_LOCK_OBTENTION_MAXIMUM_TIMEOUT = timeout_t(60 * 60, 0) |
| std::size_t | CLUCK_MAXIMUM_ENTERING_LOCKS = 100 |
| timeout_t | CLUCK_MAXIMUM_TIMEOUT = timeout_t(7 * 24 * 60 * 60, 0) |
| timeout_t | CLUCK_MINIMUM_TIMEOUT = timeout_t(3, 0) |
| timeout_t | CLUCK_UNLOCK_DEFAULT_TIMEOUT = timeout_t(5, 0) |
| timeout_t | CLUCK_UNLOCK_MINIMUM_TIMEOUT = timeout_t(3, 0) |
| typedef snapdev::timespec_ex cluck::timeout_t |
|
strong |
|
strong |
|
strong |
|
strong |
| cluck::DECLARE_EXCEPTION | ( | cluck_exception | , |
| busy | |||
| ) |
| cluck::DECLARE_EXCEPTION | ( | cluck_exception | , |
| invalid_message | |||
| ) |
| cluck::DECLARE_EXCEPTION | ( | cluck_exception | , |
| invalid_parameter | |||
| ) |
| cluck::DECLARE_EXCEPTION | ( | cluck_exception | , |
| timeout | |||
| ) |
| cluck::DECLARE_LOGIC_ERROR | ( | logic_error | ) |
| cluck::DECLARE_LOGIC_ERROR | ( | unexpected_case | ) |
| cluck::DECLARE_MAIN_EXCEPTION | ( | cluck_exception | ) |
| cluck::DECLARE_OUT_OF_RANGE | ( | out_of_range | ) |
| timeout_t cluck::get_lock_obtention_timeout | ( | ) |
Definition at line 136 of file cluck.cpp.
Referenced by cluck_daemon::cluckd::get_parameters().
| int cluck::cluck::get_major_version | ( | ) |
This function returns the major version of the running library (the one you are linked against at runtime).
Definition at line 53 of file version.cpp.
References CLUCK_VERSION_MAJOR.
| int cluck::cluck::get_patch_version | ( | ) |
This function returns the patch version of the running library (the one you are linked against at runtime).
Definition at line 79 of file version.cpp.
References CLUCK_VERSION_PATCH.
| int cluck::cluck::get_release_version | ( | ) |
This function returns the minor version of the running library (the one you are linked against at runtime).
Definition at line 66 of file version.cpp.
References CLUCK_VERSION_MINOR.
| char const * cluck::cluck::get_version_string | ( | ) |
This function returns the major, minor, and patch versions of the running library (the one you are linked against at runtime) in the form of a string.
The build version is not made available. In most cases we change the build version only to run a new build, so not code will have changed (some documentation and non-code files may changed between build versions; but the code will work exactly the same way.)
Definition at line 98 of file version.cpp.
References CLUCK_VERSION_STRING.
| bool cluck::is_lock_ready | ( | ) |
This function returns true if the cluck daemon is up and ready to receive LOCK messages. The function returns false if the cluck daemon is not yet ready.
Note that sending a LOCK message to a cluck daemon which is not ready results in the LOCK message getting cached. If the cluck daemon does not get ready before the lock times out, then a LOCK_FAILED reply is sent to the client.
A better way is for the client to wait for this flag to become true before requesting a LOCK. In effect, the initialization process of your service should take this flag in account. Until the callback passed to the listen_to_cluck_status() function is called and the is_lock_ready() function returns true, your own service is not quite fully ready.
Definition at line 259 of file cluck_status.cpp.
| void cluck::listen_to_cluck_status | ( | ed::connection_with_send_message::pointer_t | messenger, |
| ed::dispatcher::pointer_t | dispatcher, | ||
| typename ed::dispatcher_match::execute_callback_t | callback | ||
| ) |
This function adds two commands to the dispatcher:
When called, the function also emits a LOCK_STATUS command to the local cluck daemon. This ensures that we receive a status from the cluck daemon (i.e. if we missed the last change, it could take a very long time before the status of the cluck daemon changes again).
| [in] | messenger | Your messenger to send and receive commands. |
| [in] | dispatcher | Your dispatcher to listen to the LOCK_READY and NO_LOCK messages. |
| [in] | callback | A callback that gets called each time the cluck daemon status changes. |
Definition at line 201 of file cluck_status.cpp.
| void cluck::set_lock_duration_timeout | ( | timeout_t | timeout | ) |
Definition at line 166 of file cluck.cpp.
References CLUCK_DEFAULT_TIMEOUT, CLUCK_LOCK_DURATION_DEFAULT_TIMEOUT, CLUCK_MAXIMUM_TIMEOUT, and CLUCK_MINIMUM_TIMEOUT.
| void cluck::set_lock_obtention_timeout | ( | timeout_t | timeout | ) |
Definition at line 143 of file cluck.cpp.
References CLUCK_DEFAULT_TIMEOUT, CLUCK_LOCK_OBTENTION_DEFAULT_TIMEOUT, CLUCK_LOCK_OBTENTION_MAXIMUM_TIMEOUT, and CLUCK_MINIMUM_TIMEOUT.
| void cluck::set_unlock_timeout | ( | timeout_t | timeout | ) |
Definition at line 189 of file cluck.cpp.
References CLUCK_DEFAULT_TIMEOUT, CLUCK_MAXIMUM_TIMEOUT, CLUCK_UNLOCK_DEFAULT_TIMEOUT, and CLUCK_UNLOCK_MINIMUM_TIMEOUT.
Definition at line 82 of file cluck.h.
Referenced by cluck::cluck::lock(), cluck_daemon::cluckd::msg_lock(), cluck_daemon::cluckd::msg_lock_entering(), cluck_daemon::cluckd::msg_lock_tickets(), set_lock_duration_timeout(), cluck::cluck::set_lock_duration_timeout(), set_lock_obtention_timeout(), cluck::cluck::set_lock_obtention_timeout(), cluck_daemon::ticket::set_unlock_duration(), set_unlock_timeout(), and cluck::cluck::set_unlock_timeout().
Definition at line 87 of file cluck.h.
Referenced by set_lock_duration_timeout().
Definition at line 85 of file cluck.h.
Referenced by set_lock_obtention_timeout().
Definition at line 86 of file cluck.h.
Referenced by set_lock_obtention_timeout(), and cluck::cluck::set_lock_obtention_timeout().
|
inline |
Definition at line 92 of file cluck.h.
Referenced by cluck_daemon::cluckd::msg_lock().
Definition at line 84 of file cluck.h.
Referenced by set_lock_duration_timeout(), cluck::cluck::set_lock_duration_timeout(), cluck_daemon::ticket::set_unlock_duration(), set_unlock_timeout(), and cluck::cluck::set_unlock_timeout().
Definition at line 83 of file cluck.h.
Referenced by cluck_daemon::cluckd::msg_lock(), cluck_daemon::cluckd::msg_lock_entering(), set_lock_duration_timeout(), cluck::cluck::set_lock_duration_timeout(), set_lock_obtention_timeout(), and cluck::cluck::set_lock_obtention_timeout().
Definition at line 88 of file cluck.h.
Referenced by set_unlock_timeout().
Definition at line 89 of file cluck.h.
Referenced by cluck_daemon::cluckd::msg_lock(), cluck_daemon::cluckd::msg_lock_entering(), cluck_daemon::ticket::set_unlock_duration(), set_unlock_timeout(), and cluck::cluck::set_unlock_timeout().
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.