rpc_meta_brpc.proto 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Licensed to the Apache Software Foundation (ASF) under one
  2. // or more contributor license agreements. See the NOTICE file
  3. // distributed with this work for additional information
  4. // regarding copyright ownership. The ASF licenses this file
  5. // to you under the Apache License, Version 2.0 (the
  6. // "License"); you may not use this file except in compliance
  7. // with the License. You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing,
  12. // software distributed under the License is distributed on an
  13. // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. // KIND, either express or implied. See the License for the
  15. // specific language governing permissions and limitations
  16. // under the License.
  17. syntax="proto2";
  18. // Not support streaming yet
  19. //import "brpc/streaming_rpc_meta.proto";
  20. //package brpc;
  21. message BrpcMeta {
  22. optional BrpcRequestMeta request = 1;
  23. optional BrpcResponseMeta response = 2;
  24. optional int32 compress_type = 3;
  25. optional int64 correlation_id = 4;
  26. optional int32 attachment_size = 5;
  27. optional ChunkInfo chunk_info = 6;
  28. optional bytes authentication_data = 7;
  29. optional StreamSettings stream_settings = 8;
  30. }
  31. message BrpcRequestMeta {
  32. required string service_name = 1;
  33. required string method_name = 2;
  34. optional int64 log_id = 3;
  35. optional int64 trace_id = 4;
  36. optional int64 span_id = 5;
  37. optional int64 parent_span_id = 6;
  38. }
  39. message BrpcResponseMeta {
  40. optional int32 error_code = 1;
  41. optional string error_text = 2;
  42. }
  43. ////// brpc/options.proto /////////
  44. //import "google/protobuf/descriptor.proto";
  45. enum TalkType {
  46. TALK_TYPE_NORMAL = 0;
  47. TALK_TYPE_ONEWAY = 1; // TODO
  48. }
  49. enum ProtocolType {
  50. PROTOCOL_UNKNOWN = 0;
  51. PROTOCOL_BAIDU_STD = 1;
  52. /*
  53. PROTOCOL_STREAMING_RPC = 2;
  54. PROTOCOL_HULU_PBRPC = 3;
  55. PROTOCOL_SOFA_PBRPC = 4;
  56. PROTOCOL_RTMP = 5;
  57. PROTOCOL_THRIFT = 6;
  58. PROTOCOL_HTTP = 7;
  59. PROTOCOL_PUBLIC_PBRPC = 8;
  60. PROTOCOL_NOVA_PBRPC = 9;
  61. PROTOCOL_REDIS = 10;
  62. PROTOCOL_NSHEAD_CLIENT = 11; // implemented in baidu-rpc-ub
  63. PROTOCOL_NSHEAD = 12;
  64. PROTOCOL_HADOOP_RPC = 13;
  65. PROTOCOL_HADOOP_SERVER_RPC = 14;
  66. PROTOCOL_MONGO = 15; // server side only
  67. PROTOCOL_UBRPC_COMPACK = 16;
  68. PROTOCOL_DIDX_CLIENT = 17; // Client side only
  69. PROTOCOL_MEMCACHE = 18; // Client side only
  70. PROTOCOL_ITP = 19;
  71. PROTOCOL_NSHEAD_MCPACK = 20;
  72. PROTOCOL_DISP_IDL = 21; // Client side only
  73. PROTOCOL_ERSDA_CLIENT = 22; // Client side only
  74. PROTOCOL_UBRPC_MCPACK2 = 23; // Client side only
  75. // Reserve special protocol for cds-agent, which depends on FIFO right now
  76. PROTOCOL_CDS_AGENT = 24; // Client side only
  77. PROTOCOL_ESP = 25; // Client side only
  78. PROTOCOL_H2 = 26;
  79. */
  80. }
  81. message ChunkInfo {
  82. required int64 stream_id = 1;
  83. required int64 chunk_id = 2;
  84. }
  85. // for streaming
  86. message StreamSettings {
  87. required int64 stream_id = 1;
  88. optional bool need_feedback = 2 [default = false];
  89. optional bool writable = 3 [default = false];
  90. }
  91. enum FrameType {
  92. FRAME_TYPE_UNKNOWN = 0;
  93. FRAME_TYPE_RST = 1;
  94. FRAME_TYPE_CLOSE = 2;
  95. FRAME_TYPE_DATA = 3;
  96. FRAME_TYPE_FEEDBACK= 4;
  97. }
  98. message StreamFrameMeta {
  99. required int64 stream_id = 1;
  100. optional int64 source_stream_id = 2;
  101. optional FrameType frame_type = 3;
  102. optional bool has_continuation = 4;
  103. optional Feedback feedback = 5;
  104. }
  105. message Feedback {
  106. optional int64 consumed_size = 1;
  107. }
  108. /*
  109. extend google.protobuf.ServiceOptions {
  110. // Timeout in milliseconds, at service level.
  111. optional int64 service_timeout = 90000 [default = 10000];
  112. }
  113. extend google.protobuf.MethodOptions {
  114. // Talk type.
  115. optional TalkType request_talk_type = 90001 [default = TALK_TYPE_NORMAL];
  116. optional TalkType response_talk_type = 90002 [default = TALK_TYPE_NORMAL];
  117. // If set, override service_timeout.
  118. optional int64 method_timeout = 90003;
  119. // Compression for request/response.
  120. optional CompressType request_compression = 90004 [default = COMPRESS_TYPE_NONE];
  121. optional CompressType response_compression = 90005 [default = COMPRESS_TYPE_NONE];
  122. }
  123. */