class Server
Convenience wrapper for serving an xDS control plane over gRPC.
Definitions
def initialize(control_plane = ControlPlane.new, services: [Service], **options)
Initialize an xDS server.
Signature
-
parameter
control_planeControlPlane The control plane to serve.
-
parameter
servicesArray(Class) The discovery service classes to register.
-
parameter
optionsHash Default options forwarded to
Async::HTTP::Server.
Implementation
def initialize(control_plane = ControlPlane.new, services: [Service], **options)
@control_plane = control_plane
@dispatcher = Async::GRPC::Dispatcher.new
@services = services.map do |service|
service.new(@control_plane).tap do |instance|
@dispatcher.register(instance)
end
end
@options = options
end
def run(endpoint, **options)
- asynchronous
Run the xDS server on an endpoint.
Signature
-
parameter
endpointAsync::HTTP::Endpoint The endpoint to bind.
-
parameter
optionsHash Options forwarded to
Async::HTTP::Server.- asynchronous
Implementation
def run(endpoint, **options)
server = Async::HTTP::Server.new(@dispatcher, endpoint, **@options, **options)
server.run
end