Class: EventStoreClient::GRPC::Cluster::QuerylessDiscover

Inherits:
Object
  • Object
show all
Defined in:
lib/event_store_client/adapters/grpc/cluster/queryless_discover.rb

Constant Summary collapse

NoHostError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ QuerylessDiscover

Returns a new instance of QuerylessDiscover.

Parameters:



13
14
15
# File 'lib/event_store_client/adapters/grpc/cluster/queryless_discover.rb', line 13

def initialize(config:)
  @config = config
end

Instance Method Details

#call(nodes) ⇒ EventStoreClient::GRPC::Cluster::Member



19
20
21
22
23
24
25
26
27
# File 'lib/event_store_client/adapters/grpc/cluster/queryless_discover.rb', line 19

def call(nodes)
  raise NoHostError, 'No host setup' if nodes.empty?

  Member.new(host: nodes.first.host, port: nodes.first.port).tap do |member|
    config.logger&.debug(
      "Picking #{member.host}:#{member.port} member without cluster discovery."
    )
  end
end