Class: ZeevexCluster::Strategy::Base
- Inherits:
-
Object
- Object
- ZeevexCluster::Strategy::Base
- Includes:
- Hookem, Util::Logging
- Defined in:
- lib/zeevex_cluster/strategy/base.rb
Instance Method Summary collapse
- #am_i_master? ⇒ Boolean
- #has_master? ⇒ Boolean
-
#initialize(options = {}) ⇒ Base
constructor
include ZeevexThreadsafe::ThreadSafer.
- #member? ⇒ Boolean
- #online? ⇒ Boolean
- #started? ⇒ Boolean
- #state ⇒ Object
- #stopped? ⇒ Boolean
Methods included from Util::Logging
Constructor Details
#initialize(options = {}) ⇒ Base
include ZeevexThreadsafe::ThreadSafer
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 12 def initialize( = {}) @options = @namespace = [:namespace] @cluster_name = [:cluster_name] @nodename = [:nodename] || Socket.gethostname @hooks = {} @logger = [:logger] @state = :stopped reset_state_vars _initialize_hook_module if [:hooks] add_hooks [:hooks] end end |
Instance Method Details
#am_i_master? ⇒ Boolean
35 36 37 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 35 def am_i_master? @my_cluster_status == :master end |
#has_master? ⇒ Boolean
31 32 33 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 31 def has_master? !! @current_master end |
#member? ⇒ Boolean
47 48 49 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 47 def member? online? end |
#online? ⇒ Boolean
43 44 45 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 43 def online? @cluster_status == :online end |
#started? ⇒ Boolean
51 52 53 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 51 def started? @state == :started end |
#state ⇒ Object
39 40 41 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 39 def state @state end |
#stopped? ⇒ Boolean
55 56 57 |
# File 'lib/zeevex_cluster/strategy/base.rb', line 55 def stopped? @state == :stopped end |