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, **options) ⇒ Server

Initialize an xDS server.



20
21
22
23
24
25
# File 'lib/async/grpc/xds/server.rb', line 20

def initialize(control_plane = ControlPlane.new, **options)
	@control_plane = control_plane
	@dispatcher = Async::GRPC::Dispatcher.new
	@dispatcher.register(Service.new(@control_plane))
	@options = options
end

Instance Attribute Details

#control_planeObject (readonly)

Returns the value of attribute control_plane.



27
28
29
# File 'lib/async/grpc/xds/server.rb', line 27

def control_plane
  @control_plane
end

#dispatcherObject (readonly)

Returns the value of attribute dispatcher.



28
29
30
# File 'lib/async/grpc/xds/server.rb', line 28

def dispatcher
  @dispatcher
end

Instance Method Details

#run(endpoint, **options) ⇒ Object

Run the xDS server on an endpoint.



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

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