Class: EventStoreClient::GRPC::Connection
- Inherits:
-
Object
- Object
- EventStoreClient::GRPC::Connection
- Extended by:
- Configuration
- Includes:
- Configuration, Extensions::OptionsExtension
- Defined in:
- lib/event_store_client/adapters/grpc/connection.rb
Direct Known Subclasses
EventStoreClient::GRPC::Cluster::InsecureConnection, EventStoreClient::GRPC::Cluster::SecureConnection
Class Method Summary collapse
-
.new(*args, **kwargs, &blk) ⇒ Object
Resolve which connection class we instantiate, based on config.eventstore_url.tls config option.
-
.secure? ⇒ Boolean
Checks if connection class is secure.
Instance Method Summary collapse
Methods included from Configuration
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
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
55 56 57 |
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 55 def call(stub_class) raise NotImplementedError end |