Class: EventStoreClient::GRPC::Connection

Inherits:
Object
  • Object
show all
Extended by:
Configuration
Includes:
Configuration, Extensions::OptionsExtension
Defined in:
lib/event_store_client/adapters/grpc/connection.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Configuration

config

Methods included from Extensions::OptionsExtension

included, #initialize, #options_hash

Class Method Details

.new(*args, **kwargs, &blk) ⇒ Object

Resolve which connection class we instantiate, based on config.eventstore_url.tls config option. If :new method is called from SecureConnection or InsecureConnection class - then that particular class will be instantiated despite on config.eventstore_url.tls config option. Example:

```ruby
config.eventstore_url.tls = true
Connection.new # => #<EventStoreClient::GRPC::Cluster::SecureConnection>

config.eventstore_url.tls = false
Connection.new # => #<EventStoreClient::GRPC::Cluster::InsecureConnection>

Cluster::SecureConnection.new
# => #<EventStoreClient::GRPC::Cluster::SecureConnection>
Cluster::InsecureConnection.new
# => #<EventStoreClient::GRPC::Cluster::InsecureConnection>
```


38
39
40
41
42
43
44
45
46
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 38

def new(*args, **kwargs, &blk)
  return super unless self == Connection

  if config.eventstore_url.tls
    Cluster::SecureConnection.new(*args, **kwargs, &blk)
  else
    Cluster::InsecureConnection.new(*args, **kwargs, &blk)
  end
end

.secure?Boolean

Checks if connection class is secure

Returns:

  • (Boolean)


50
51
52
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 50

def secure?
  self == Cluster::SecureConnection
end

Instance Method Details

#call(stub_class) ⇒ Object

Raises:

  • (NotImplementedError)


55
56
57
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 55

def call(stub_class)
  raise NotImplementedError
end