module Aerospike::Cluster::CreateConnection

Create connection based on cluster config and authenticate if needed

Public Class Methods

call(cluster, host) click to toggle source
# File lib/aerospike/cluster/create_connection.rb, line 25
def call(cluster, host)
  ::Aerospike::Connection::Create.(
    host.name,
    host.port,
    tls_name: host.tls_name,
    timeout: cluster.connection_timeout,
    tls_options: cluster.tls_options
  ).tap do |conn|
    if cluster.credentials_given?
      # Authenticate will raise and close connection if invalid credentials
      Connection::AuthenticateNew.(conn, cluster)
    end
  end
end