Class: Async::GRPC::XDS::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/async/grpc/xds/server.rb

Overview

Convenience wrapper for serving an xDS control plane over gRPC.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(control_plane = ControlPlane.new, services: [Service], **options) ⇒ Server

Initialize an xDS server.



21
22
23
24
25
26
27
28
29
30
# File 'lib/async/grpc/xds/server.rb', line 21

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

Instance Attribute Details

#control_planeObject (readonly)

Returns the value of attribute control_plane.



32
33
34
# File 'lib/async/grpc/xds/server.rb', line 32

def control_plane
  @control_plane
end

#dispatcherObject (readonly)

Returns the value of attribute dispatcher.



33
34
35
# File 'lib/async/grpc/xds/server.rb', line 33

def dispatcher
  @dispatcher
end

#servicesObject (readonly)

Returns the value of attribute services.



34
35
36
# File 'lib/async/grpc/xds/server.rb', line 34

def services
  @services
end

Instance Method Details

#run(endpoint, **options) ⇒ Object

Run the xDS server on an endpoint.



40
41
42
43
# File 'lib/async/grpc/xds/server.rb', line 40

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