Use stream rpc to ensure all related requests go to a single server

pull/6414/head
Yuchen Zeng 9 years ago
parent d50b58c3f6
commit 175dbbc6d7
  1. 141
      src/proto/grpc/reflection/v1alpha/reflection.proto

@ -34,85 +34,98 @@ syntax = "proto3";
package grpc.reflection.v1alpha; package grpc.reflection.v1alpha;
service ServerReflection { service ServerReflection {
// List the full names of registered services. // The reflection service is structured as a bidirectional stream, ensuring
rpc ListService(EmptyRequest) returns (ListServiceResponse) { // all related requests go to a single server.
} rpc DescriptorDatabaseInfo(stream DescriptorDatabaseRequest)
returns (stream DescriptorDatabaseResponse);
// Find a proto file by file name.
rpc GetFileByName(FileNameRequest) returns (FileDescriptorProtoResponse) {
}
// Find the proto file that declares the given fully-qualified symbol name.
rpc GetFileContainingSymbol(SymbolRequest)
returns (FileDescriptorProtoResponse) {
}
// Find the proto file which defines an extension extending the given message
// type with the given field number.
rpc GetFileContainingExtension(ExtensionRequest)
returns (FileDescriptorProtoResponse) {
}
// Finds the tag numbers used by all known extensions of extendee_type, and
// appends them to ExtensionNumberResponse in an undefined order.
// This method is best-effort: it's not guaranteed that the reflection service
// will implement this method, and it's not guaranteed that this method will
// provide all extensions. Returns StatusCode::UNIMPLEMENTED if it's not
// implemented.
rpc GetAllExtensionNumbers(TypeRequest) returns (ExtensionNumberResponse) {
}
}
// An empty message sent by the client when calling ListService method.
message EmptyRequest {
}
// The filename sent by the client when calling GetFileByName method.
message FileNameRequest {
// Name of the proto file.
string filename = 1;
} }
// The symbol name sent by the client when calling GetFileContainingSymbol // The message sent by the client when calling DescriptorDatabaseInfo method.
// method. message DescriptorDatabaseRequest {
message SymbolRequest { string host = 1;
// Fully-qualified symbol name (e.g. <package>.<service>[.<method>] or // To use reflection service, the client should set one of the following
// <package>.<type>). // fields in message_request. The server distinguishes requests by their
string symbol = 1; // defined field and then handles them using corresponding methods.
oneof message_request {
// Find a proto file by the file name.
string file_by_filename = 3;
// Find the proto file that declares the given fully-qualified symbol name.
// This field should be a fully-qualified symbol name
// (e.g. <package>.<service>[.<method>] or <package>.<type>).
string file_containing_symbol = 4;
// Find the proto file which defines an extension extending the given
// message type with the given field number.
ExtensionRequest file_containing_extension = 5;
// Finds the tag numbers used by all known extensions of extendee_type, and
// appends them to ExtensionNumberResponse in an undefined order.
// Its corresponding method is best-effort: it's not guaranteed that the
// reflection service will implement this method, and it's not guaranteed
// that this method will provide all extensions. Returns
// StatusCode::UNIMPLEMENTED if it's not implemented.
// This field should be a fully-qualified type name. The format is
// <package>.<type>
string all_extension_numbers_of_type = 6;
// List the full names of registered services. The content will not be
// checked.
string list_services = 7;
}
} }
// The type name and extension number sent by the client when calling // The type name and extension number sent by the client when requesting
// GetFileContainingExtension method. // file_containing_extension.
message ExtensionRequest { message ExtensionRequest {
// Fully-qualified type name. The format should be <package>.<type> // Fully-qualified type name. The format should be <package>.<type>
string containing_type = 1; string containing_type = 1;
int32 extension_number = 2; int32 extension_number = 2;
} }
// The type name sent by the client when calling GetAllExtensionNumbers method. // The message sent by the server to answer DescriptorDatabaseInfo method.
message TypeRequest { message DescriptorDatabaseResponse {
// Fully-qualified type name. The format should be <package>.<type> string valid_host = 1;
string type = 1; DescriptorDatabaseRequest original_request = 2;
// The server set one of the following fields accroding to the message_request
// in the request.
oneof message_response {
// A serialized FileDescriptorProto message. We avoid taking a dependency on
// descriptor.proto, which uses proto2 only features, by making them opaque
// bytes instead. This message is used to answer file_by_filename,
// file_containing_symbol, file_containing_extension requests.
bytes file_descriptor_proto = 4;
// This message is used to answer all_extension_numbers_of_type requst.
ExtensionNumberResponse all_extension_numbers_response = 5;
// This message is used to answer list_services request.
ListServiceResponse list_services_response = 6;
// This message is used when an error occurs.
ErrorResponse error_response = 7;
}
}
// A list of extension numbers sent by the server answering
// all_extension_numbers_of_type request.
message ExtensionNumberResponse {
// Full name of the base type, including the package name. The format
// is <package>.<type>
string base_type_name = 1;
repeated int32 extension_number = 2;
} }
// A list of service names sent by the server answering ListService method. // A list of service names sent by the server answering list_services request.
message ListServiceResponse { message ListServiceResponse {
// Full names of registered services, including package names. The format // Full names of registered services, including package names. The format
// is <package>.<service> // is <package>.<service>
repeated string services = 1; repeated string service = 1;
}
// A serialized FileDescriptorProto sent by the server answering
// GetFileByName, GetFileContainingSymbol, GetFileContainingExtension methods.
message FileDescriptorProtoResponse {
// Serialized FileDescriptorProto message. Some languages have limited support
// for working with descriptors. The can only obtain an opaque binary blob
// that contains serialized FileDescriptorProto message.
bytes file_descriptor_proto = 1;
} }
// A list of extension numbers sent by the server answering // The error code and error message sent by the server when an error occurs.
// GetAllExtensionNumbers method. message ErrorResponse {
message ExtensionNumberResponse { // This field uses the error codes defined in grpc::StatusCode.
repeated int32 extension_number = 1; int32 error_code = 1;
string error_message = 2;
} }

Loading…
Cancel
Save