Class: Kumonos::Clusters::Cluster
- Inherits:
-
Struct
- Object
- Struct
- Kumonos::Clusters::Cluster
- Defined in:
- lib/kumonos/clusters.rb
Instance Attribute Summary collapse
-
#circuit_breaker ⇒ Object
Returns the value of attribute circuit_breaker.
-
#connect_timeout_ms ⇒ Object
Returns the value of attribute connect_timeout_ms.
-
#lb ⇒ Object
Returns the value of attribute lb.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tls ⇒ Object
Returns the value of attribute tls.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#circuit_breaker ⇒ Object
Returns the value of attribute circuit_breaker
12 13 14 |
# File 'lib/kumonos/clusters.rb', line 12 def circuit_breaker @circuit_breaker end |
#connect_timeout_ms ⇒ Object
Returns the value of attribute connect_timeout_ms
12 13 14 |
# File 'lib/kumonos/clusters.rb', line 12 def connect_timeout_ms @connect_timeout_ms end |
#lb ⇒ Object
Returns the value of attribute lb
12 13 14 |
# File 'lib/kumonos/clusters.rb', line 12 def lb @lb end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/kumonos/clusters.rb', line 12 def name @name end |
#tls ⇒ Object
Returns the value of attribute tls
12 13 14 |
# File 'lib/kumonos/clusters.rb', line 12 def tls @tls end |
Class Method Details
.build(h) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/kumonos/clusters.rb', line 14 def build(h) new( h.fetch('name'), h.fetch('connect_timeout_ms'), h.fetch('lb'), h.fetch('tls'), CircuitBreaker.build(h.fetch('circuit_breaker')) ) end |
Instance Method Details
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/kumonos/clusters.rb', line 25 def to_h h = super h.delete(:lb) h[:type] = 'strict_dns' h[:lb_type] = 'round_robin' h[:hosts] = [{ url: "tcp://#{lb}" }] h.delete(:tls) h[:ssl_context] = {} if tls h.delete(:circuit_breaker) h[:circuit_breakers] = { default: circuit_breaker.to_h } h end |