Class: EventStoreClient::GRPC::Cluster::QuerylessDiscover
- Inherits:
-
Object
- Object
- EventStoreClient::GRPC::Cluster::QuerylessDiscover
- Defined in:
- lib/event_store_client/adapters/grpc/cluster/queryless_discover.rb
Constant Summary collapse
- NoHostError =
Class.new(StandardError)
Instance Method Summary collapse
- #call(nodes) ⇒ EventStoreClient::GRPC::Cluster::Member
-
#initialize(config:) ⇒ QuerylessDiscover
constructor
A new instance of QuerylessDiscover.
Constructor Details
#initialize(config:) ⇒ QuerylessDiscover
Returns a new instance of QuerylessDiscover.
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 |