Class: Async::Service::Supervisor::Envoy::Delegate
- Inherits:
-
Object
- Object
- Async::Service::Supervisor::Envoy::Delegate
- Defined in:
- lib/async/service/supervisor/envoy/delegate.rb
Overview
Maps supervisor state into Envoy upstream endpoints.
Instance Method Summary collapse
-
#cluster(supervisor_controller, endpoint) ⇒ Object
Select the Envoy cluster name for an endpoint.
-
#endpoint_list(supervisor_controller) ⇒ Object
Convert serialized state into Envoy endpoint values.
-
#endpoints(supervisor_controller) ⇒ Object
Extract serialized endpoints from a supervisor controller.
-
#healthy?(supervisor_controller, endpoint) ⇒ Boolean
Determine whether an endpoint should be published as healthy.
Instance Method Details
#cluster(supervisor_controller, endpoint) ⇒ Object
Select the Envoy cluster name for an endpoint.
41 42 43 |
# File 'lib/async/service/supervisor/envoy/delegate.rb', line 41 def cluster(supervisor_controller, endpoint) endpoint.name end |
#endpoint_list(supervisor_controller) ⇒ Object
Convert serialized state into Envoy endpoint values.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/async/service/supervisor/envoy/delegate.rb', line 26 def endpoint_list(supervisor_controller) case endpoints = self.endpoints(supervisor_controller) when nil [] when Array endpoints.map{|endpoint| Endpoint.wrap(endpoint)} else [Endpoint.wrap(endpoints)] end end |
#endpoints(supervisor_controller) ⇒ Object
Extract serialized endpoints from a supervisor controller.
17 18 19 20 21 |
# File 'lib/async/service/supervisor/envoy/delegate.rb', line 17 def endpoints(supervisor_controller) state = supervisor_controller.state state[:endpoints] || state[:endpoint] end |
#healthy?(supervisor_controller, endpoint) ⇒ Boolean
Determine whether an endpoint should be published as healthy.
49 50 51 |
# File 'lib/async/service/supervisor/envoy/delegate.rb', line 49 def healthy?(supervisor_controller, endpoint) true end |