module EventStore::HTTP::Connect::Leader
Constants
Public Class Methods
build(settings=nil, namespace: nil)
click to toggle source
# File lib/event_store/http/connect/leader.rb, line 5 def self.build(settings=nil, namespace: nil) instance = Connect.build settings, namespace: namespace instance.extend self instance end
Public Instance Methods
connect(net_http=nil)
click to toggle source
Calls superclass method
# File lib/event_store/http/connect/leader.rb, line 11 def connect(net_http=nil) net_http ||= super() member_info = Info.(connection: net_http) return net_http if member_info.leader? cluster_status = Gossip.(connection: net_http) if cluster_status.leader.nil? error_message = "Leader is unavailable (Host: #{host}, Port: #{port})" logger.error { error_message } raise LeaderUnavailableError, error_message end leader_ip_address = cluster_status.leader.external_http_ip raw leader_ip_address end