gritz-native 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11284795837121fb007d3158c2fa704281946741d262e2101cf0ab3b134183e5
4
- data.tar.gz: b1c1a7c414f1b3f435af88183f8da23dd7aaabcff4591355dbfdd138deeffcb0
3
+ metadata.gz: 9f9935b25f48cab22b5894c8333f99c0685215de5aadeda73458e4d38530ad3a
4
+ data.tar.gz: 88c50b7d8f68b9e1b6f22db5df05ec1ca549cc3ae3db41aa0a7518d8671986c9
5
5
  SHA512:
6
- metadata.gz: 832837820eb0ecb86bef7fe3cf84514f52a22b92933fb08bf9fd8d3cb48fee690585ba42c853bee984bdd801fb93c7fdaa96e5a873ffee93b976b417f99f08b0
7
- data.tar.gz: f7b4a6ba6ba8ad367db6d6d486fc041471f73a7fa72663ed90ee71ed1445122d287c92c2ceaef986b9b7572445f3c03960e4a65f01af4588be904b2c67d251a8
6
+ metadata.gz: 1558d382904a12cc19d224df061d43dda12641d8e241bb9bce9d4c82995a9fab4823a7bf763b72d4547ccb5016bdfe2cb534ec60bdb04cb452b8e47fba7d3603
7
+ data.tar.gz: 22edc7681709a4da4be50ec22406f0dbb6e3e1bf1cdda2e7dd10b90c98f1ff2fe698f641cf9e402c75cea3011c9a5fbcea5919acf93159ff7eb2db0c758e73cb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ - Discover registered RPCs and protobuf types through gRPC Reflection v1 and v1alpha when `reflection` is enabled.
6
+ - Support gritz-core 0.5.0.
7
+
8
+ ## 0.4.0
9
+
10
+ - Connect `Gritz::Client` to all four native RPC forms with shared worker-local channels and deferred credentials.
11
+ - Cancel unfinished response streams and decode downstream status, trailers and protobuf rich error details into typed Gritz errors.
12
+ - Pass retry and load-balancing service configuration to the native channel.
13
+ - Run installed worker telemetry with real-server test helpers and close it after the final RPC observations.
14
+
3
15
  ## 0.3.0
4
16
 
5
17
  - Serve TLS and mTLS connections and expose authenticated client certificates to handlers.
data/README.md CHANGED
@@ -10,6 +10,10 @@ require "gritz/native"
10
10
 
11
11
  The entry point loads `gritz-core` and registers `Gritz::Transport::Native`. The configuration value is `transport :native`. Use [gritz](https://github.com/gritzrpc/gritz) for the default combination and executable. The Fiber adapter `gritz-async` is planned separately.
12
12
 
13
+ The adapter also connects `Gritz::Client.define` to all four RPC forms, sharing channels within each worker and creating fresh connections after fork. It cancels unfinished streams, decodes rich downstream errors, and passes retry/load-balancing configuration to C-core. See the [client guide](https://github.com/gritzrpc/gritz-core/blob/main/docs/guides/clients.md).
14
+
15
+ The [three-service integration report](https://github.com/gritzrpc/gritz-otel/blob/main/docs/reports/T4-08-client-chain.md) records worker-local channels, propagated deadlines, connected server/client spans and real OTLP/HTTP metrics.
16
+
13
17
  ```ruby
14
18
  Gritz::Testing::Server.start(controllers: [GreeterController]) do |server|
15
19
  stub = Helloworld::Greeter::Stub.new(server.address, :this_channel_is_insecure)
@@ -19,6 +23,8 @@ end
19
23
 
20
24
  The helper opens an ephemeral port and stops the server when the block exits. The helper runs a single process. Supervised native servers support forked workers on Linux. TLS and required client certificate verification are configured with `tls cert:, key:, client_ca:`. Standard gRPC Health Check/Watch tracks application checks and draining. See the [Kubernetes guide](docs/guides/kubernetes.md) and [framework configuration](https://github.com/gritzrpc/gritz-core/blob/main/docs/guides/configuration.md).
21
25
 
26
+ Set `reflection true` to enable gRPC Reflection v1/v1alpha for registered services, message descriptors and protobuf imports. The default is disabled. See the [Reflection guide](docs/guides/reflection.md).
27
+
22
28
  ## Development
23
29
 
24
30
  ```sh
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gritz
4
4
  module Native
5
- VERSION = "0.3.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
data/lib/gritz/native.rb CHANGED
@@ -12,4 +12,7 @@ require_relative "transport/native/call"
12
12
  require_relative "transport/native/bridge"
13
13
  require_relative "transport/native/server"
14
14
  require_relative "transport/native/health"
15
+ require_relative "transport/native/client"
15
16
  require_relative "testing/server"
17
+
18
+ Gritz::Client.adapter = Gritz::Transport::Native::Client
@@ -39,10 +39,11 @@ module Gritz
39
39
  begin
40
40
  @config.preload! if @config.preload_app?
41
41
  router = Router.new(controllers: @config.controllers, strict: @config.strict_routes, logger: @logger)
42
- dispatcher = Dispatcher.new(router:, middleware: @config.middleware, logger: @logger)
43
- @transport = Transport::Native.new(config: @config, dispatcher:, logger: @logger)
44
42
  @lifecycle_started = true
45
43
  @config.run_hooks(:on_worker_boot, 0)
44
+ @recorder = @config.metrics_recorder_factory&.call(worker: 0)
45
+ dispatcher = Dispatcher.new(router:, middleware: @config.middleware, logger: @logger, metrics: @recorder)
46
+ @transport = Transport::Native.new(config: @config, dispatcher:, logger: @logger)
46
47
  @port = transport.bind
47
48
  @address = @config.bind.sub(/:\d+\z/, ":#{port}")
48
49
  transport.start
@@ -63,16 +64,30 @@ module Gritz
63
64
  return if @stopped
64
65
 
65
66
  @stopped = true
67
+ deadline = monotonic + @config.shutdown_timeout
66
68
  begin
67
69
  @health_stop&.push(true)
68
- if @health_thread && !@health_thread.join(@config.shutdown_timeout)
70
+ if @health_thread && !@health_thread.join([deadline - monotonic, 0].max)
69
71
  @health_thread.kill.join
70
72
  end
71
- transport&.stop(deadline: Time.now + @config.shutdown_timeout)
73
+ transport&.stop(deadline: Time.now + [deadline - monotonic, 0].max)
72
74
  ensure
73
- @config.run_hooks(:on_worker_shutdown, 0) if @lifecycle_started
75
+ begin
76
+ @config.run_hooks(:on_worker_shutdown, 0) if @lifecycle_started
77
+ ensure
78
+ begin
79
+ @recorder&.observe_rejected(transport.stats.fetch(:rejected_total, 0)) if transport
80
+ @recorder&.observe_worker({ pid: Process.pid, index: 0, state: "stopped" })
81
+ ensure
82
+ @recorder&.close(timeout: [deadline - monotonic, 0].max)
83
+ end
84
+ end
74
85
  end
75
86
  end
87
+
88
+ private
89
+
90
+ def monotonic = Process.clock_gettime(Process::CLOCK_MONOTONIC)
76
91
  end
77
92
  end
78
93
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "client_invocation"
4
+
5
+ module Gritz
6
+ module Transport
7
+ class Native
8
+ # Builds official gRPC connections only on the first process-local client call.
9
+ # @api private
10
+ class Client
11
+ Connection = Struct.new(:target, :credentials, :args, :channel, keyword_init: true)
12
+
13
+ def self.connect(target:, credentials:, args:)
14
+ resolved = credentials.respond_to?(:call) ? credentials.call : credentials
15
+ resolved = :this_channel_is_insecure if resolved == :insecure
16
+ channel_credentials = resolved.is_a?(GRPC::Core::CallCredentials) ? GRPC::Core::ChannelCredentials.new : resolved
17
+ channel = GRPC::ClientStub.setup_channel(nil, target, channel_credentials, args.dup)
18
+ Connection.new(target:, credentials: resolved, args:, channel:)
19
+ end
20
+
21
+ def self.invoke(stub_class:, connection:, method:, request:, options:, around:, &)
22
+ stub = stub_class.new(connection.target, connection.credentials,
23
+ channel_override: connection.channel, channel_args: connection.args.dup)
24
+ stub.extend(ClientInvocation)
25
+ stub.instance_variable_set(:@gritz_around, around)
26
+ stub.public_send(method, request, options, &)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gritz
4
+ module Transport
5
+ class Native
6
+ # Captures the generated stub's route and keeps middleware around native completion.
7
+ # @api private
8
+ module ClientInvocation
9
+ { request_response: :unary, client_streamer: :client_streaming,
10
+ server_streamer: :server_streaming, bidi_streamer: :bidi }.each do |native_method, kind|
11
+ define_method(native_method) do |method, request, marshal, unmarshal, **options, &block|
12
+ terminal = lambda do |context, &_reply|
13
+ execute_gritz_client(context) do |response|
14
+ input = context.method.client_streaming? ? context.each_request : context.request
15
+ super(method, input, marshal, unmarshal, **context.options.merge(return_op: true), &response)
16
+ end
17
+ end
18
+ @gritz_around.call(terminal, method:, kind:, request:, options:, &block)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def execute_gritz_client(context)
25
+ context.check_deadline!
26
+ context.check_cancelled!
27
+ response = if context.method.server_streaming?
28
+ lambda do |message|
29
+ context.check_deadline!
30
+ context.check_cancelled!
31
+ context.response_block.call(message)
32
+ end
33
+ end
34
+ operation = yield(response)
35
+ context.operation = operation
36
+ result = operation.execute
37
+ completed = true
38
+ result
39
+ rescue GRPC::BadStatus => e
40
+ raise decode_gritz_error(e)
41
+ ensure
42
+ if operation && !completed
43
+ context.store[:gritz_cancelled] = true
44
+ cancel_gritz_operation(operation)
45
+ end
46
+ end
47
+
48
+ def cancel_gritz_operation(operation)
49
+ operation.cancel
50
+ rescue GRPC::Core::CallError
51
+ # A received non-OK status may already have closed the native call.
52
+ nil
53
+ end
54
+
55
+ def decode_gritz_error(error)
56
+ status = begin
57
+ error.to_rpc_status
58
+ rescue Google::Protobuf::ParseError, TypeError, ArgumentError
59
+ nil
60
+ end
61
+ details = if status && status.code == error.code
62
+ status.details.map { |any| decode_gritz_detail(any) }
63
+ else
64
+ []
65
+ end
66
+ code = error.code.is_a?(Integer) && (1...Errors::CODES.length).cover?(error.code) ? error.code : 2
67
+ klass = Errors.for_code(code)
68
+ klass.new(error.details, details:, metadata: error.metadata.dup, remote: true)
69
+ end
70
+
71
+ def decode_gritz_detail(any)
72
+ descriptor = Google::Protobuf::DescriptorPool.generated_pool.lookup(any.type_name)
73
+ descriptor.respond_to?(:msgclass) ? any.unpack(descriptor.msgclass) : any
74
+ rescue Google::Protobuf::ParseError, TypeError, ArgumentError
75
+ any
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "google/protobuf/descriptor_pb"
4
+ require "grpc/reflection/v1/reflection_services_pb"
5
+ require "grpc/reflection/v1alpha/reflection_services_pb"
6
+
7
+ module Gritz
8
+ module Transport
9
+ class Native
10
+ # Exposes only registered services and their transitive protobuf imports.
11
+ # @api private
12
+ class Reflection
13
+ PROTOCOLS = [Grpc::Reflection::V1, Grpc::Reflection::V1alpha].freeze
14
+
15
+ def self.build(service_names)
16
+ names = (service_names + PROTOCOLS.map { |types| types::ServerReflection::Service.service_name }).uniq.sort
17
+ database = new(names)
18
+ PROTOCOLS.map do |types|
19
+ Class.new(types::ServerReflection::Service) do
20
+ self.service_name = types::ServerReflection::Service.service_name
21
+ define_method(:server_reflection_info) do |requests, _call|
22
+ requests.lazy.map { |request| database.response(request, types) }
23
+ end
24
+ end.new
25
+ end
26
+ end
27
+
28
+ def initialize(service_names)
29
+ @services = service_names
30
+ @files = {}
31
+ @symbols = {}
32
+ @messages = Set.new
33
+ @extensions = {}
34
+ @pool = Google::Protobuf::DescriptorPool.generated_pool
35
+ service_names.each do |name|
36
+ descriptor = @pool.lookup(name)
37
+ unless descriptor.is_a?(Google::Protobuf::ServiceDescriptor)
38
+ raise ConfigurationError, "Reflection requires a protobuf service descriptor for #{name}"
39
+ end
40
+
41
+ index_file(descriptor.file_descriptor.to_proto)
42
+ end
43
+ end
44
+
45
+ def response(request, types)
46
+ payload = case request.message_request
47
+ when :list_services
48
+ { list_services_response: types::ListServiceResponse.new(service: @services.map { |name| types::ServiceResponse.new(name:) }) }
49
+ when :file_by_filename
50
+ file_response(request.file_by_filename, types)
51
+ when :file_containing_symbol
52
+ file_response(@symbols[request.file_containing_symbol], types)
53
+ when :file_containing_extension
54
+ extension = request.file_containing_extension
55
+ file_response(@extensions[[extension.containing_type, extension.extension_number]], types)
56
+ when :all_extension_numbers_of_type
57
+ name = request.all_extension_numbers_of_type
58
+ if @messages.include?(name)
59
+ numbers = @extensions.keys.filter_map { |type, number| number if type == name }
60
+ { all_extension_numbers_response: types::ExtensionNumberResponse.new(base_type_name: name, extension_number: numbers.sort) }
61
+ else
62
+ error(types, GRPC::Core::StatusCodes::NOT_FOUND, "Message type not found")
63
+ end
64
+ else
65
+ error(types, GRPC::Core::StatusCodes::INVALID_ARGUMENT, "Reflection request is missing")
66
+ end
67
+ types::ServerReflectionResponse.new(valid_host: request.host, original_request: request, **payload)
68
+ end
69
+
70
+ private
71
+
72
+ def index_file(file)
73
+ return if @files.key?(file.name)
74
+
75
+ @files[file.name] = file
76
+ index_messages(file.message_type, file.package, file.name)
77
+ index_enums(file.enum_type, file.package, file.name)
78
+ index_extensions(file.extension, file.package, file.name)
79
+ file.service.each do |service|
80
+ name = qualify(file.package, service.name)
81
+ @symbols[name] = file.name
82
+ service["method"].each { |method| @symbols["#{name}.#{method.name}"] = file.name }
83
+ end
84
+ file.dependency.each do |name|
85
+ descriptor = @pool.lookup(name)
86
+ raise ConfigurationError, "Reflection cannot find imported protobuf file #{name}" unless descriptor
87
+
88
+ index_file(descriptor.to_proto)
89
+ end
90
+ end
91
+
92
+ def index_messages(messages, scope, file)
93
+ messages.each do |message|
94
+ name = qualify(scope, message.name)
95
+ @symbols[name] = file
96
+ @messages.add(name)
97
+ (message.field.to_a + message.oneof_decl.to_a).each { |field| @symbols["#{name}.#{field.name}"] = file }
98
+ index_messages(message.nested_type, name, file)
99
+ index_enums(message.enum_type, name, file)
100
+ index_extensions(message.extension, name, file)
101
+ end
102
+ end
103
+
104
+ def index_enums(enums, scope, file)
105
+ enums.each do |enum|
106
+ name = qualify(scope, enum.name)
107
+ @symbols[name] = file
108
+ enum.value.each { |value| @symbols["#{name}.#{value.name}"] = @symbols[qualify(scope, value.name)] = file }
109
+ end
110
+ end
111
+
112
+ def index_extensions(extensions, scope, file)
113
+ extensions.each do |extension|
114
+ @symbols[qualify(scope, extension.name)] = file
115
+ @extensions[[extension.extendee.delete_prefix("."), extension.number]] = file
116
+ end
117
+ end
118
+
119
+ def qualify(scope, name) = scope.empty? ? name : "#{scope}.#{name}"
120
+
121
+ def file_response(name, types)
122
+ return error(types, GRPC::Core::StatusCodes::NOT_FOUND, "Protobuf file or symbol not found") unless @files.key?(name)
123
+
124
+ seen = Set.new
125
+ files = []
126
+ visit = lambda do |file_name|
127
+ return unless seen.add?(file_name)
128
+
129
+ file = @files.fetch(file_name)
130
+ file.dependency.each { |dependency| visit.call(dependency) }
131
+ files << Google::Protobuf::FileDescriptorProto.encode(file)
132
+ end
133
+ visit.call(name)
134
+ { file_descriptor_response: types::FileDescriptorResponse.new(file_descriptor_proto: files.reverse) }
135
+ end
136
+
137
+ def error(types, code, message)
138
+ { error_response: types::ErrorResponse.new(error_code: code, error_message: message) }
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -8,7 +8,7 @@ module Gritz
8
8
  # Runs generated services through Gritz's transport-independent dispatcher.
9
9
  # @api public
10
10
  class Native
11
- def self.capabilities = Set[:unary, :client_streaming, :server_streaming, :bidi, :reuseport, :health, :tls, :mtls].freeze
11
+ def self.capabilities = Set[:unary, :client_streaming, :server_streaming, :bidi, :reuseport, :health, :tls, :mtls, :reflection].freeze
12
12
 
13
13
  def self.prefork
14
14
  GRPC.prefork
@@ -49,6 +49,11 @@ module Gritz
49
49
  end
50
50
  @health = Health.new(@dispatcher.router.routes.values.map(&:service).uniq)
51
51
  @server.handle(@health)
52
+ if @config.reflection
53
+ require_relative "native/reflection"
54
+ services = @dispatcher.router.routes.values.map(&:service).uniq + [Health.service_name]
55
+ Reflection.build(services).each { |service| @server.handle(service) }
56
+ end
52
57
  @port = @server.add_http2_port(listener_spec, credentials)
53
58
  raise ArgumentError, "could not bind #{listener_spec}" unless @port.positive?
54
59
 
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: grpc/reflection/v1/reflection.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n#grpc/reflection/v1/reflection.proto\x12\x12grpc.reflection.v1\"\x85\x02\n\x17ServerReflectionRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x1a\n\x10\x66ile_by_filename\x18\x03 \x01(\tH\x00\x12 \n\x16\x66ile_containing_symbol\x18\x04 \x01(\tH\x00\x12I\n\x19\x66ile_containing_extension\x18\x05 \x01(\x0b\x32$.grpc.reflection.v1.ExtensionRequestH\x00\x12\'\n\x1d\x61ll_extension_numbers_of_type\x18\x06 \x01(\tH\x00\x12\x17\n\rlist_services\x18\x07 \x01(\tH\x00\x42\x11\n\x0fmessage_request\"E\n\x10\x45xtensionRequest\x12\x17\n\x0f\x63ontaining_type\x18\x01 \x01(\t\x12\x18\n\x10\x65xtension_number\x18\x02 \x01(\x05\"\xb8\x03\n\x18ServerReflectionResponse\x12\x12\n\nvalid_host\x18\x01 \x01(\t\x12\x45\n\x10original_request\x18\x02 \x01(\x0b\x32+.grpc.reflection.v1.ServerReflectionRequest\x12N\n\x18\x66ile_descriptor_response\x18\x04 \x01(\x0b\x32*.grpc.reflection.v1.FileDescriptorResponseH\x00\x12U\n\x1e\x61ll_extension_numbers_response\x18\x05 \x01(\x0b\x32+.grpc.reflection.v1.ExtensionNumberResponseH\x00\x12I\n\x16list_services_response\x18\x06 \x01(\x0b\x32\'.grpc.reflection.v1.ListServiceResponseH\x00\x12;\n\x0e\x65rror_response\x18\x07 \x01(\x0b\x32!.grpc.reflection.v1.ErrorResponseH\x00\x42\x12\n\x10message_response\"7\n\x16\x46ileDescriptorResponse\x12\x1d\n\x15\x66ile_descriptor_proto\x18\x01 \x03(\x0c\"K\n\x17\x45xtensionNumberResponse\x12\x16\n\x0e\x62\x61se_type_name\x18\x01 \x01(\t\x12\x18\n\x10\x65xtension_number\x18\x02 \x03(\x05\"K\n\x13ListServiceResponse\x12\x34\n\x07service\x18\x01 \x03(\x0b\x32#.grpc.reflection.v1.ServiceResponse\"\x1f\n\x0fServiceResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\":\n\rErrorResponse\x12\x12\n\nerror_code\x18\x01 \x01(\x05\x12\x15\n\rerror_message\x18\x02 \x01(\t2\x89\x01\n\x10ServerReflection\x12u\n\x14ServerReflectionInfo\x12+.grpc.reflection.v1.ServerReflectionRequest\x1a,.grpc.reflection.v1.ServerReflectionResponse(\x01\x30\x01\x42\x66\n\x15io.grpc.reflection.v1B\x15ServerReflectionProtoP\x01Z4google.golang.org/grpc/reflection/grpc_reflection_v1b\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Grpc
14
+ module Reflection
15
+ module V1
16
+ ServerReflectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ServerReflectionRequest").msgclass
17
+ ExtensionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ExtensionRequest").msgclass
18
+ ServerReflectionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ServerReflectionResponse").msgclass
19
+ FileDescriptorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.FileDescriptorResponse").msgclass
20
+ ExtensionNumberResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ExtensionNumberResponse").msgclass
21
+ ListServiceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ListServiceResponse").msgclass
22
+ ServiceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ServiceResponse").msgclass
23
+ ErrorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1.ErrorResponse").msgclass
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,50 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: grpc/reflection/v1/reflection.proto for package 'grpc.reflection.v1'
3
+ # Original file comments:
4
+ # Copyright 2016 The gRPC Authors
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Service exported by server reflection. A more complete description of how
19
+ # server reflection works can be found at
20
+ # https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
21
+ #
22
+ # The canonical version of this proto can be found at
23
+ # https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
24
+ #
25
+
26
+ require 'grpc'
27
+ require 'grpc/reflection/v1/reflection_pb'
28
+
29
+ module Grpc
30
+ module Reflection
31
+ module V1
32
+ module ServerReflection
33
+ class Service
34
+
35
+ include ::GRPC::GenericService
36
+
37
+ self.marshal_class_method = :encode
38
+ self.unmarshal_class_method = :decode
39
+ self.service_name = 'grpc.reflection.v1.ServerReflection'
40
+
41
+ # The reflection service is structured as a bidirectional stream, ensuring
42
+ # all related requests go to a single server.
43
+ rpc :ServerReflectionInfo, stream(::Grpc::Reflection::V1::ServerReflectionRequest), stream(::Grpc::Reflection::V1::ServerReflectionResponse)
44
+ end
45
+
46
+ Stub = Service.rpc_stub_class
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: grpc/reflection/v1alpha/reflection.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n(grpc/reflection/v1alpha/reflection.proto\x12\x17grpc.reflection.v1alpha\"\x8a\x02\n\x17ServerReflectionRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x1a\n\x10\x66ile_by_filename\x18\x03 \x01(\tH\x00\x12 \n\x16\x66ile_containing_symbol\x18\x04 \x01(\tH\x00\x12N\n\x19\x66ile_containing_extension\x18\x05 \x01(\x0b\x32).grpc.reflection.v1alpha.ExtensionRequestH\x00\x12\'\n\x1d\x61ll_extension_numbers_of_type\x18\x06 \x01(\tH\x00\x12\x17\n\rlist_services\x18\x07 \x01(\tH\x00\x42\x11\n\x0fmessage_request\"E\n\x10\x45xtensionRequest\x12\x17\n\x0f\x63ontaining_type\x18\x01 \x01(\t\x12\x18\n\x10\x65xtension_number\x18\x02 \x01(\x05\"\xd1\x03\n\x18ServerReflectionResponse\x12\x12\n\nvalid_host\x18\x01 \x01(\t\x12J\n\x10original_request\x18\x02 \x01(\x0b\x32\x30.grpc.reflection.v1alpha.ServerReflectionRequest\x12S\n\x18\x66ile_descriptor_response\x18\x04 \x01(\x0b\x32/.grpc.reflection.v1alpha.FileDescriptorResponseH\x00\x12Z\n\x1e\x61ll_extension_numbers_response\x18\x05 \x01(\x0b\x32\x30.grpc.reflection.v1alpha.ExtensionNumberResponseH\x00\x12N\n\x16list_services_response\x18\x06 \x01(\x0b\x32,.grpc.reflection.v1alpha.ListServiceResponseH\x00\x12@\n\x0e\x65rror_response\x18\x07 \x01(\x0b\x32&.grpc.reflection.v1alpha.ErrorResponseH\x00\x42\x12\n\x10message_response\"7\n\x16\x46ileDescriptorResponse\x12\x1d\n\x15\x66ile_descriptor_proto\x18\x01 \x03(\x0c\"K\n\x17\x45xtensionNumberResponse\x12\x16\n\x0e\x62\x61se_type_name\x18\x01 \x01(\t\x12\x18\n\x10\x65xtension_number\x18\x02 \x03(\x05\"P\n\x13ListServiceResponse\x12\x39\n\x07service\x18\x01 \x03(\x0b\x32(.grpc.reflection.v1alpha.ServiceResponse\"\x1f\n\x0fServiceResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\":\n\rErrorResponse\x12\x12\n\nerror_code\x18\x01 \x01(\x05\x12\x15\n\rerror_message\x18\x02 \x01(\t2\x93\x01\n\x10ServerReflection\x12\x7f\n\x14ServerReflectionInfo\x12\x30.grpc.reflection.v1alpha.ServerReflectionRequest\x1a\x31.grpc.reflection.v1alpha.ServerReflectionResponse(\x01\x30\x01\x42s\n\x1aio.grpc.reflection.v1alphaB\x15ServerReflectionProtoP\x01Z9google.golang.org/grpc/reflection/grpc_reflection_v1alpha\xb8\x01\x01\x62\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Grpc
14
+ module Reflection
15
+ module V1alpha
16
+ ServerReflectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ServerReflectionRequest").msgclass
17
+ ExtensionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ExtensionRequest").msgclass
18
+ ServerReflectionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ServerReflectionResponse").msgclass
19
+ FileDescriptorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.FileDescriptorResponse").msgclass
20
+ ExtensionNumberResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ExtensionNumberResponse").msgclass
21
+ ListServiceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ListServiceResponse").msgclass
22
+ ServiceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ServiceResponse").msgclass
23
+ ErrorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.reflection.v1alpha.ErrorResponse").msgclass
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,47 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: grpc/reflection/v1alpha/reflection.proto for package 'grpc.reflection.v1alpha'
3
+ # Original file comments:
4
+ # Copyright 2016 The gRPC Authors
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ # Service exported by server reflection
18
+ #
19
+ # Warning: this entire file is deprecated. Use this instead:
20
+ # https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
21
+ #
22
+
23
+ require 'grpc'
24
+ require 'grpc/reflection/v1alpha/reflection_pb'
25
+
26
+ module Grpc
27
+ module Reflection
28
+ module V1alpha
29
+ module ServerReflection
30
+ class Service
31
+
32
+ include ::GRPC::GenericService
33
+
34
+ self.marshal_class_method = :encode
35
+ self.unmarshal_class_method = :decode
36
+ self.service_name = 'grpc.reflection.v1alpha.ServerReflection'
37
+
38
+ # The reflection service is structured as a bidirectional stream, ensuring
39
+ # all related requests go to a single server.
40
+ rpc :ServerReflectionInfo, stream(::Grpc::Reflection::V1alpha::ServerReflectionRequest), stream(::Grpc::Reflection::V1alpha::ServerReflectionResponse)
41
+ end
42
+
43
+ Stub = Service.rpc_stub_class
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,147 @@
1
+ // Copyright 2016 The gRPC Authors
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // Service exported by server reflection. A more complete description of how
16
+ // server reflection works can be found at
17
+ // https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
18
+ //
19
+ // The canonical version of this proto can be found at
20
+ // https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
21
+
22
+ syntax = "proto3";
23
+
24
+ package grpc.reflection.v1;
25
+
26
+ option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1";
27
+ option java_multiple_files = true;
28
+ option java_package = "io.grpc.reflection.v1";
29
+ option java_outer_classname = "ServerReflectionProto";
30
+
31
+ service ServerReflection {
32
+ // The reflection service is structured as a bidirectional stream, ensuring
33
+ // all related requests go to a single server.
34
+ rpc ServerReflectionInfo(stream ServerReflectionRequest)
35
+ returns (stream ServerReflectionResponse);
36
+ }
37
+
38
+ // The message sent by the client when calling ServerReflectionInfo method.
39
+ message ServerReflectionRequest {
40
+ string host = 1;
41
+ // To use reflection service, the client should set one of the following
42
+ // fields in message_request. The server distinguishes requests by their
43
+ // defined field and then handles them using corresponding methods.
44
+ oneof message_request {
45
+ // Find a proto file by the file name.
46
+ string file_by_filename = 3;
47
+
48
+ // Find the proto file that declares the given fully-qualified symbol name.
49
+ // This field should be a fully-qualified symbol name
50
+ // (e.g. <package>.<service>[.<method>] or <package>.<type>).
51
+ string file_containing_symbol = 4;
52
+
53
+ // Find the proto file which defines an extension extending the given
54
+ // message type with the given field number.
55
+ ExtensionRequest file_containing_extension = 5;
56
+
57
+ // Finds the tag numbers used by all known extensions of the given message
58
+ // type, and appends them to ExtensionNumberResponse in an undefined order.
59
+ // Its corresponding method is best-effort: it's not guaranteed that the
60
+ // reflection service will implement this method, and it's not guaranteed
61
+ // that this method will provide all extensions. Returns
62
+ // StatusCode::UNIMPLEMENTED if it's not implemented.
63
+ // This field should be a fully-qualified type name. The format is
64
+ // <package>.<type>
65
+ string all_extension_numbers_of_type = 6;
66
+
67
+ // List the full names of registered services. The content will not be
68
+ // checked.
69
+ string list_services = 7;
70
+ }
71
+ }
72
+
73
+ // The type name and extension number sent by the client when requesting
74
+ // file_containing_extension.
75
+ message ExtensionRequest {
76
+ // Fully-qualified type name. The format should be <package>.<type>
77
+ string containing_type = 1;
78
+ int32 extension_number = 2;
79
+ }
80
+
81
+ // The message sent by the server to answer ServerReflectionInfo method.
82
+ message ServerReflectionResponse {
83
+ string valid_host = 1;
84
+ ServerReflectionRequest original_request = 2;
85
+ // The server sets one of the following fields according to the message_request
86
+ // in the request.
87
+ oneof message_response {
88
+ // This message is used to answer file_by_filename, file_containing_symbol,
89
+ // file_containing_extension requests with transitive dependencies.
90
+ // As the repeated label is not allowed in oneof fields, we use a
91
+ // FileDescriptorResponse message to encapsulate the repeated fields.
92
+ // The reflection service is allowed to avoid sending FileDescriptorProtos
93
+ // that were previously sent in response to earlier requests in the stream.
94
+ FileDescriptorResponse file_descriptor_response = 4;
95
+
96
+ // This message is used to answer all_extension_numbers_of_type requests.
97
+ ExtensionNumberResponse all_extension_numbers_response = 5;
98
+
99
+ // This message is used to answer list_services requests.
100
+ ListServiceResponse list_services_response = 6;
101
+
102
+ // This message is used when an error occurs.
103
+ ErrorResponse error_response = 7;
104
+ }
105
+ }
106
+
107
+ // Serialized FileDescriptorProto messages sent by the server answering
108
+ // a file_by_filename, file_containing_symbol, or file_containing_extension
109
+ // request.
110
+ message FileDescriptorResponse {
111
+ // Serialized FileDescriptorProto messages. We avoid taking a dependency on
112
+ // descriptor.proto, which uses proto2 only features, by making them opaque
113
+ // bytes instead.
114
+ repeated bytes file_descriptor_proto = 1;
115
+ }
116
+
117
+ // A list of extension numbers sent by the server answering
118
+ // all_extension_numbers_of_type request.
119
+ message ExtensionNumberResponse {
120
+ // Full name of the base type, including the package name. The format
121
+ // is <package>.<type>
122
+ string base_type_name = 1;
123
+ repeated int32 extension_number = 2;
124
+ }
125
+
126
+ // A list of ServiceResponse sent by the server answering list_services request.
127
+ message ListServiceResponse {
128
+ // The information of each service may be expanded in the future, so we use
129
+ // ServiceResponse message to encapsulate it.
130
+ repeated ServiceResponse service = 1;
131
+ }
132
+
133
+ // The information of a single service used by ListServiceResponse to answer
134
+ // list_services request.
135
+ message ServiceResponse {
136
+ // Full name of a registered service, including its package name. The format
137
+ // is <package>.<service>
138
+ string name = 1;
139
+ }
140
+
141
+ // The error code and error message sent by the server when an error occurs.
142
+ message ErrorResponse {
143
+ // This field uses the error codes defined in grpc::StatusCode.
144
+ int32 error_code = 1;
145
+ string error_message = 2;
146
+ }
147
+
@@ -0,0 +1,145 @@
1
+ // Copyright 2016 The gRPC Authors
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ // Service exported by server reflection
15
+
16
+
17
+ // Warning: this entire file is deprecated. Use this instead:
18
+ // https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
19
+
20
+ syntax = "proto3";
21
+
22
+ package grpc.reflection.v1alpha;
23
+
24
+ option deprecated = true;
25
+ option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1alpha";
26
+ option java_multiple_files = true;
27
+ option java_package = "io.grpc.reflection.v1alpha";
28
+ option java_outer_classname = "ServerReflectionProto";
29
+
30
+ service ServerReflection {
31
+ // The reflection service is structured as a bidirectional stream, ensuring
32
+ // all related requests go to a single server.
33
+ rpc ServerReflectionInfo(stream ServerReflectionRequest)
34
+ returns (stream ServerReflectionResponse);
35
+ }
36
+
37
+ // The message sent by the client when calling ServerReflectionInfo method.
38
+ message ServerReflectionRequest {
39
+ string host = 1;
40
+ // To use reflection service, the client should set one of the following
41
+ // fields in message_request. The server distinguishes requests by their
42
+ // defined field and then handles them using corresponding methods.
43
+ oneof message_request {
44
+ // Find a proto file by the file name.
45
+ string file_by_filename = 3;
46
+
47
+ // Find the proto file that declares the given fully-qualified symbol name.
48
+ // This field should be a fully-qualified symbol name
49
+ // (e.g. <package>.<service>[.<method>] or <package>.<type>).
50
+ string file_containing_symbol = 4;
51
+
52
+ // Find the proto file which defines an extension extending the given
53
+ // message type with the given field number.
54
+ ExtensionRequest file_containing_extension = 5;
55
+
56
+ // Finds the tag numbers used by all known extensions of extendee_type, and
57
+ // appends them to ExtensionNumberResponse in an undefined order.
58
+ // Its corresponding method is best-effort: it's not guaranteed that the
59
+ // reflection service will implement this method, and it's not guaranteed
60
+ // that this method will provide all extensions. Returns
61
+ // StatusCode::UNIMPLEMENTED if it's not implemented.
62
+ // This field should be a fully-qualified type name. The format is
63
+ // <package>.<type>
64
+ string all_extension_numbers_of_type = 6;
65
+
66
+ // List the full names of registered services. The content will not be
67
+ // checked.
68
+ string list_services = 7;
69
+ }
70
+ }
71
+
72
+ // The type name and extension number sent by the client when requesting
73
+ // file_containing_extension.
74
+ message ExtensionRequest {
75
+ // Fully-qualified type name. The format should be <package>.<type>
76
+ string containing_type = 1;
77
+ int32 extension_number = 2;
78
+ }
79
+
80
+ // The message sent by the server to answer ServerReflectionInfo method.
81
+ message ServerReflectionResponse {
82
+ string valid_host = 1;
83
+ ServerReflectionRequest original_request = 2;
84
+ // The server set one of the following fields according to the message_request
85
+ // in the request.
86
+ oneof message_response {
87
+ // This message is used to answer file_by_filename, file_containing_symbol,
88
+ // file_containing_extension requests with transitive dependencies. As
89
+ // the repeated label is not allowed in oneof fields, we use a
90
+ // FileDescriptorResponse message to encapsulate the repeated fields.
91
+ // The reflection service is allowed to avoid sending FileDescriptorProtos
92
+ // that were previously sent in response to earlier requests in the stream.
93
+ FileDescriptorResponse file_descriptor_response = 4;
94
+
95
+ // This message is used to answer all_extension_numbers_of_type request.
96
+ ExtensionNumberResponse all_extension_numbers_response = 5;
97
+
98
+ // This message is used to answer list_services request.
99
+ ListServiceResponse list_services_response = 6;
100
+
101
+ // This message is used when an error occurs.
102
+ ErrorResponse error_response = 7;
103
+ }
104
+ }
105
+
106
+ // Serialized FileDescriptorProto messages sent by the server answering
107
+ // a file_by_filename, file_containing_symbol, or file_containing_extension
108
+ // request.
109
+ message FileDescriptorResponse {
110
+ // Serialized FileDescriptorProto messages. We avoid taking a dependency on
111
+ // descriptor.proto, which uses proto2 only features, by making them opaque
112
+ // bytes instead.
113
+ repeated bytes file_descriptor_proto = 1;
114
+ }
115
+
116
+ // A list of extension numbers sent by the server answering
117
+ // all_extension_numbers_of_type request.
118
+ message ExtensionNumberResponse {
119
+ // Full name of the base type, including the package name. The format
120
+ // is <package>.<type>
121
+ string base_type_name = 1;
122
+ repeated int32 extension_number = 2;
123
+ }
124
+
125
+ // A list of ServiceResponse sent by the server answering list_services request.
126
+ message ListServiceResponse {
127
+ // The information of each service may be expanded in the future, so we use
128
+ // ServiceResponse message to encapsulate it.
129
+ repeated ServiceResponse service = 1;
130
+ }
131
+
132
+ // The information of a single service used by ListServiceResponse to answer
133
+ // list_services request.
134
+ message ServiceResponse {
135
+ // Full name of a registered service, including its package name. The format
136
+ // is <package>.<service>
137
+ string name = 1;
138
+ }
139
+
140
+ // The error code and error message sent by the server when an error occurs.
141
+ message ErrorResponse {
142
+ // This field uses the error codes defined in grpc::StatusCode.
143
+ int32 error_code = 1;
144
+ string error_message = 2;
145
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gritz-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada
@@ -35,14 +35,14 @@ dependencies:
35
35
  requirements:
36
36
  - - '='
37
37
  - !ruby/object:Gem::Version
38
- version: 0.3.0
38
+ version: 0.5.0
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 0.3.0
45
+ version: 0.5.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: grpc
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -81,8 +81,18 @@ files:
81
81
  - lib/gritz/transport/native.rb
82
82
  - lib/gritz/transport/native/bridge.rb
83
83
  - lib/gritz/transport/native/call.rb
84
+ - lib/gritz/transport/native/client.rb
85
+ - lib/gritz/transport/native/client_invocation.rb
84
86
  - lib/gritz/transport/native/health.rb
87
+ - lib/gritz/transport/native/reflection.rb
85
88
  - lib/gritz/transport/native/server.rb
89
+ - lib/grpc/reflection/v1/reflection_pb.rb
90
+ - lib/grpc/reflection/v1/reflection_services_pb.rb
91
+ - lib/grpc/reflection/v1alpha/reflection_pb.rb
92
+ - lib/grpc/reflection/v1alpha/reflection_services_pb.rb
93
+ - proto/LICENSE.grpc-proto
94
+ - proto/grpc/reflection/v1/reflection.proto
95
+ - proto/grpc/reflection/v1alpha/reflection.proto
86
96
  homepage: https://github.com/gritzrpc/gritz-native
87
97
  licenses:
88
98
  - MIT