You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

137 lines
5.3 KiB

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