Class: LS4::MembershipMemberService

Inherits:
MembershipClientService show all
Defined in:
lib/ls4/service/membership.rb

Instance Method Summary collapse

Methods inherited from MembershipClientService

#run

Methods inherited from MembershipService

#get_active_rsids, #get_all_nodes, #get_node, #get_session_nid, #is_fault, #on_fault_list_change, #on_membership_change, #run, #shutdown, #stat_fault_info, #stat_membership_info, #stat_replset_info

Methods inherited from Service

init

Methods included from EventBus::SingletonMixin

#ebus_bind!, #ebus_connect, extended

Methods included from EventBus::BusMixin

#ebus_all_slots, #ebus_disconnect!

Methods included from EventBus::DeclarerBase::Methods

#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots

Methods included from EventBus::DeclarerBase

#call_slot, #signal_slot

Constructor Details

#initializeMembershipMemberService

Returns a new instance of MembershipMemberService.



255
256
257
258
259
260
261
262
# File 'lib/ls4/service/membership.rb', line 255

def initialize
  super
  @self_nid = ConfigBus.self_nid
  @self_address = ConfigBus.self_address
  @self_name = ConfigBus.self_name
  @self_rsids = ConfigBus.self_rsids
  @self_location = ConfigBus.self_location
end

Instance Method Details

#register_self_blocking!Object



294
295
296
# File 'lib/ls4/service/membership.rb', line 294

def register_self_blocking!
  do_register_self.join
end

#try_register_nodeObject



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/ls4/service/membership.rb', line 264

def try_register_node
  begin
    node = @membership.get_node(@self_nid)
  rescue
    return register_self
  end

  if node.address != @self_address
    return register_self
  end

  if node.name != @self_name
    return register_self
  end

  if node.rsids != @self_rsids
    return register_self
  end

  if node.location != @self_location
    return register_self
  end

  if @fault_list.include?(@self_nid)
    return register_self
  end

  nil
end