Async::GRPC::XDSSourceAsyncGRPCXDSServer

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_plane ControlPlane

The control plane to serve.

parameter services Array(Class)

The discovery service classes to register.

parameter options Hash

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 endpoint Async::HTTP::Endpoint

The endpoint to bind.

parameter options Hash

Options forwarded to Async::HTTP::Server.

asynchronous

Implementation

def run(endpoint, **options)
	server = Async::HTTP::Server.new(@dispatcher, endpoint, **@options, **options)
	server.run
end