reflection.proto 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. // Warning: this entire file is deprecated. Use this instead:
  16. // https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
  17. syntax = "proto3";
  18. package grpc.reflection.v1alpha;
  19. option deprecated = true;
  20. option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1alpha";
  21. option java_multiple_files = true;
  22. option java_package = "io.grpc.reflection.v1alpha";
  23. option java_outer_classname = "ServerReflectionProto";
  24. service ServerReflection {
  25. // The reflection service is structured as a bidirectional stream, ensuring
  26. // all related requests go to a single server.
  27. rpc ServerReflectionInfo(stream ServerReflectionRequest)
  28. returns (stream ServerReflectionResponse);
  29. }
  30. // The message sent by the client when calling ServerReflectionInfo method.
  31. message ServerReflectionRequest {
  32. string host = 1;
  33. // To use reflection service, the client should set one of the following
  34. // fields in message_request. The server distinguishes requests by their
  35. // defined field and then handles them using corresponding methods.
  36. oneof message_request {
  37. // Find a proto file by the file name.
  38. string file_by_filename = 3;
  39. // Find the proto file that declares the given fully-qualified symbol name.
  40. // This field should be a fully-qualified symbol name
  41. // (e.g. <package>.<service>[.<method>] or <package>.<type>).
  42. string file_containing_symbol = 4;
  43. // Find the proto file which defines an extension extending the given
  44. // message type with the given field number.
  45. ExtensionRequest file_containing_extension = 5;
  46. // Finds the tag numbers used by all known extensions of extendee_type, and
  47. // appends them to ExtensionNumberResponse in an undefined order.
  48. // Its corresponding method is best-effort: it's not guaranteed that the
  49. // reflection service will implement this method, and it's not guaranteed
  50. // that this method will provide all extensions. Returns
  51. // StatusCode::UNIMPLEMENTED if it's not implemented.
  52. // This field should be a fully-qualified type name. The format is
  53. // <package>.<type>
  54. string all_extension_numbers_of_type = 6;
  55. // List the full names of registered services. The content will not be
  56. // checked.
  57. string list_services = 7;
  58. }
  59. }
  60. // The type name and extension number sent by the client when requesting
  61. // file_containing_extension.
  62. message ExtensionRequest {
  63. // Fully-qualified type name. The format should be <package>.<type>
  64. string containing_type = 1;
  65. int32 extension_number = 2;
  66. }
  67. // The message sent by the server to answer ServerReflectionInfo method.
  68. message ServerReflectionResponse {
  69. string valid_host = 1;
  70. ServerReflectionRequest original_request = 2;
  71. // The server set one of the following fields according to the message_request
  72. // in the request.
  73. oneof message_response {
  74. // This message is used to answer file_by_filename, file_containing_symbol,
  75. // file_containing_extension requests with transitive dependencies. As
  76. // the repeated label is not allowed in oneof fields, we use a
  77. // FileDescriptorResponse message to encapsulate the repeated fields.
  78. // The reflection service is allowed to avoid sending FileDescriptorProtos
  79. // that were previously sent in response to earlier requests in the stream.
  80. FileDescriptorResponse file_descriptor_response = 4;
  81. // This message is used to answer all_extension_numbers_of_type requst.
  82. ExtensionNumberResponse all_extension_numbers_response = 5;
  83. // This message is used to answer list_services request.
  84. ListServiceResponse list_services_response = 6;
  85. // This message is used when an error occurs.
  86. ErrorResponse error_response = 7;
  87. }
  88. }
  89. // Serialized FileDescriptorProto messages sent by the server answering
  90. // a file_by_filename, file_containing_symbol, or file_containing_extension
  91. // request.
  92. message FileDescriptorResponse {
  93. // Serialized FileDescriptorProto messages. We avoid taking a dependency on
  94. // descriptor.proto, which uses proto2 only features, by making them opaque
  95. // bytes instead.
  96. repeated bytes file_descriptor_proto = 1;
  97. }
  98. // A list of extension numbers sent by the server answering
  99. // all_extension_numbers_of_type request.
  100. message ExtensionNumberResponse {
  101. // Full name of the base type, including the package name. The format
  102. // is <package>.<type>
  103. string base_type_name = 1;
  104. repeated int32 extension_number = 2;
  105. }
  106. // A list of ServiceResponse sent by the server answering list_services request.
  107. message ListServiceResponse {
  108. // The information of each service may be expanded in the future, so we use
  109. // ServiceResponse message to encapsulate it.
  110. repeated ServiceResponse service = 1;
  111. }
  112. // The information of a single service used by ListServiceResponse to answer
  113. // list_services request.
  114. message ServiceResponse {
  115. // Full name of a registered service, including its package name. The format
  116. // is <package>.<service>
  117. string name = 1;
  118. }
  119. // The error code and error message sent by the server when an error occurs.
  120. message ErrorResponse {
  121. // This field uses the error codes defined in grpc::StatusCode.
  122. int32 error_code = 1;
  123. string error_message = 2;
  124. }