Class: EventStoreClient::GRPC::Connection
- Inherits:
-
Object
- Object
- EventStoreClient::GRPC::Connection
- Includes:
- 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(config:, **options) ⇒ 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
- #call(stub_class) ⇒ Object
-
#initialize(config:, **options) ⇒ Connection
constructor
A new instance of Connection.
Methods included from Extensions::OptionsExtension
Constructor Details
#initialize(config:, **options) ⇒ Connection
Returns a new instance of Connection.
56 57 58 59 |
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 56 def initialize(config:, **) @config = config super end |
Class Method Details
.new(config:, **options) ⇒ 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>
```
28 29 30 31 32 33 34 35 36 |
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 28 def new(config:, **) return super unless self == Connection if config.eventstore_url.tls Cluster::SecureConnection.new(config: config, **) else Cluster::InsecureConnection.new(config: config, **) end end |
.secure? ⇒ Boolean
Checks if connection class is secure
40 41 42 |
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 40 def secure? self == Cluster::SecureConnection end |
Instance Method Details
#call(stub_class) ⇒ Object
61 62 63 |
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 61 def call(stub_class) raise NotImplementedError end |