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.

248 lines
6.1 KiB

3 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. syntax = "proto3";
  2. package messaging_pb;
  3. option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb";
  4. option java_package = "seaweedfs.mq";
  5. option java_outer_classname = "MessagQueueProto";
  6. //////////////////////////////////////////////////
  7. service SeaweedMessaging {
  8. // control plane
  9. rpc FindBrokerLeader (FindBrokerLeaderRequest) returns (FindBrokerLeaderResponse) {
  10. }
  11. rpc AssignSegmentBrokers (AssignSegmentBrokersRequest) returns (AssignSegmentBrokersResponse) {
  12. }
  13. rpc CheckSegmentStatus (CheckSegmentStatusRequest) returns (CheckSegmentStatusResponse) {
  14. }
  15. rpc CheckBrokerLoad (CheckBrokerLoadRequest) returns (CheckBrokerLoadResponse) {
  16. }
  17. // control plane for balancer
  18. rpc ConnectToBalancer (stream ConnectToBalancerRequest) returns (stream ConnectToBalancerResponse) {
  19. }
  20. rpc DoConfigureTopic (DoConfigureTopicRequest) returns (DoConfigureTopicResponse) {
  21. }
  22. // control plane for topic partitions
  23. rpc LookupTopicBrokers (LookupTopicBrokersRequest) returns (LookupTopicBrokersResponse) {
  24. }
  25. rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
  26. }
  27. rpc ListTopics (ListTopicsRequest) returns (ListTopicsResponse) {
  28. }
  29. // a pub client will call this to get the topic partitions assignment
  30. rpc RequestTopicPartitions (RequestTopicPartitionsRequest) returns (RequestTopicPartitionsResponse) {
  31. }
  32. rpc AssignTopicPartitions (AssignTopicPartitionsRequest) returns (AssignTopicPartitionsResponse) {
  33. }
  34. rpc CheckTopicPartitionsStatus (CheckTopicPartitionsStatusRequest) returns (CheckTopicPartitionsStatusResponse) {
  35. }
  36. // data plane
  37. rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
  38. }
  39. rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
  40. }
  41. }
  42. //////////////////////////////////////////////////
  43. message SegmentInfo {
  44. Segment segment = 1;
  45. int64 start_ts_ns = 2;
  46. repeated string brokers = 3;
  47. int64 stop_ts_ns = 4;
  48. repeated int32 previous_segments = 5;
  49. repeated int32 next_segments = 6;
  50. }
  51. //////////////////////////////////////////////////
  52. message FindBrokerLeaderRequest {
  53. string filer_group = 1;
  54. }
  55. message FindBrokerLeaderResponse {
  56. string broker = 1;
  57. }
  58. message Topic {
  59. string namespace = 1;
  60. string name = 2;
  61. }
  62. message Partition {
  63. int32 ring_size = 1;
  64. int32 range_start = 2;
  65. int32 range_stop = 3;
  66. }
  67. message Segment {
  68. string namespace = 1;
  69. string topic = 2;
  70. int32 id = 3;
  71. Partition partition = 4;
  72. }
  73. message AssignSegmentBrokersRequest {
  74. Segment segment = 1;
  75. }
  76. message AssignSegmentBrokersResponse {
  77. repeated string brokers = 1;
  78. }
  79. message CheckSegmentStatusRequest {
  80. Segment segment = 1;
  81. }
  82. message CheckSegmentStatusResponse {
  83. bool is_active = 1;
  84. }
  85. message CheckBrokerLoadRequest {
  86. }
  87. message CheckBrokerLoadResponse {
  88. int64 message_count = 1;
  89. int64 bytes_count = 2;
  90. }
  91. //////////////////////////////////////////////////
  92. message BrokerStats {
  93. int32 cpu_usage_percent = 1;
  94. map<string, TopicPartitionStats> stats = 2;
  95. }
  96. message TopicPartitionStats {
  97. Topic topic = 1;
  98. Partition partition = 2;
  99. int32 consumer_count = 3;
  100. bool is_leader = 4;
  101. }
  102. message ConnectToBalancerRequest {
  103. message InitMessage {
  104. string broker = 1;
  105. }
  106. oneof message {
  107. InitMessage init = 1;
  108. BrokerStats stats = 2;
  109. }
  110. }
  111. message ConnectToBalancerResponse {
  112. }
  113. //////////////////////////////////////////////////
  114. message ConfigureTopicRequest {
  115. Topic topic = 1;
  116. int32 partition_count = 2;
  117. }
  118. message ConfigureTopicResponse {
  119. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  120. }
  121. message DoConfigureTopicRequest {
  122. Topic topic = 1;
  123. Partition partition = 2;
  124. }
  125. message DoConfigureTopicResponse {
  126. }
  127. message ListTopicsRequest {
  128. }
  129. message ListTopicsResponse {
  130. repeated Topic topics = 1;
  131. }
  132. message LookupTopicBrokersRequest {
  133. Topic topic = 1;
  134. bool is_for_publish = 2;
  135. }
  136. message LookupTopicBrokersResponse {
  137. Topic topic = 1;
  138. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  139. }
  140. message BrokerPartitionAssignment {
  141. Partition partition = 1;
  142. string leader_broker = 2;
  143. repeated string follower_brokers = 3;
  144. }
  145. message RequestTopicPartitionsRequest {
  146. Topic topic = 1;
  147. int32 partition_count = 2;
  148. }
  149. message RequestTopicPartitionsResponse {
  150. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  151. }
  152. message AssignTopicPartitionsRequest {
  153. Topic topic = 1;
  154. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  155. bool is_leader = 3;
  156. }
  157. message AssignTopicPartitionsResponse {
  158. }
  159. message CheckTopicPartitionsStatusRequest {
  160. string namespace = 1;
  161. string topic = 2;
  162. BrokerPartitionAssignment broker_partition_assignment = 3;
  163. bool should_cancel_if_not_match = 4;
  164. }
  165. message CheckTopicPartitionsStatusResponse {
  166. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  167. }
  168. //////////////////////////////////////////////////
  169. message DataMessage {
  170. bytes key = 1;
  171. bytes value = 2;
  172. }
  173. message PublishRequest {
  174. message InitMessage {
  175. Topic topic = 1;
  176. Partition partition = 2;
  177. int32 ack_interval = 3;
  178. }
  179. oneof message {
  180. InitMessage init = 1;
  181. DataMessage data = 2;
  182. }
  183. int64 sequence = 3;
  184. }
  185. message PublishResponse {
  186. int64 ack_sequence = 1;
  187. string error = 2;
  188. string redirect_to_broker = 3;
  189. }
  190. message SubscribeRequest {
  191. message InitMessage {
  192. string consumer_group = 1;
  193. string consumer_id = 2;
  194. string client_id = 3;
  195. Topic topic = 4;
  196. Partition partition = 5;
  197. oneof offset {
  198. int64 start_offset = 6;
  199. int64 start_timestamp_ns = 7;
  200. }
  201. string filter = 8;
  202. }
  203. message AckMessage {
  204. int64 sequence = 1;
  205. }
  206. oneof message {
  207. InitMessage init = 1;
  208. AckMessage ack = 2;
  209. }
  210. }
  211. message SubscribeResponse {
  212. message CtrlMessage {
  213. string error = 1;
  214. bool is_end_of_stream = 2;
  215. bool is_end_of_topic = 3;
  216. }
  217. oneof message {
  218. CtrlMessage ctrl = 1;
  219. DataMessage data = 2;
  220. }
  221. }