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.

213 lines
5.3 KiB

3 years ago
2 years ago
2 years ago
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago
2 years 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 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. // control plane for topic partitions
  21. rpc LookupTopicBrokers (LookupTopicBrokersRequest) returns (LookupTopicBrokersResponse) {
  22. }
  23. // a pub client will call this to get the topic partitions assignment
  24. rpc RequestTopicPartitions (RequestTopicPartitionsRequest) returns (RequestTopicPartitionsResponse) {
  25. }
  26. rpc AssignTopicPartitions (AssignTopicPartitionsRequest) returns (AssignTopicPartitionsResponse) {
  27. }
  28. rpc CheckTopicPartitionsStatus (CheckTopicPartitionsStatusRequest) returns (CheckTopicPartitionsStatusResponse) {
  29. }
  30. // data plane
  31. rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
  32. }
  33. rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
  34. }
  35. }
  36. //////////////////////////////////////////////////
  37. message SegmentInfo {
  38. Segment segment = 1;
  39. int64 start_ts_ns = 2;
  40. repeated string brokers = 3;
  41. int64 stop_ts_ns = 4;
  42. repeated int32 previous_segments = 5;
  43. repeated int32 next_segments = 6;
  44. }
  45. //////////////////////////////////////////////////
  46. message FindBrokerLeaderRequest {
  47. string filer_group = 1;
  48. }
  49. message FindBrokerLeaderResponse {
  50. string broker = 1;
  51. }
  52. message Topic {
  53. string namespace = 1;
  54. string name = 2;
  55. }
  56. message Partition {
  57. int32 ring_size = 1;
  58. int32 range_start = 2;
  59. int32 range_stop = 3;
  60. }
  61. message Segment {
  62. string namespace = 1;
  63. string topic = 2;
  64. int32 id = 3;
  65. Partition partition = 4;
  66. }
  67. message AssignSegmentBrokersRequest {
  68. Segment segment = 1;
  69. }
  70. message AssignSegmentBrokersResponse {
  71. repeated string brokers = 1;
  72. }
  73. message CheckSegmentStatusRequest {
  74. Segment segment = 1;
  75. }
  76. message CheckSegmentStatusResponse {
  77. bool is_active = 1;
  78. }
  79. message CheckBrokerLoadRequest {
  80. }
  81. message CheckBrokerLoadResponse {
  82. int64 message_count = 1;
  83. int64 bytes_count = 2;
  84. }
  85. //////////////////////////////////////////////////
  86. message BrokerStats {
  87. int32 topic_partition_count = 1;
  88. int32 consumer_count = 2;
  89. int32 cpu_usage_percent = 3;
  90. }
  91. message ConnectToBalancerRequest {
  92. message InitMessage {
  93. string broker = 1;
  94. }
  95. oneof message {
  96. InitMessage init = 1;
  97. BrokerStats stats = 2;
  98. }
  99. }
  100. message ConnectToBalancerResponse {
  101. }
  102. //////////////////////////////////////////////////
  103. message LookupTopicBrokersRequest {
  104. Topic topic = 1;
  105. bool is_for_publish = 2;
  106. }
  107. message LookupTopicBrokersResponse {
  108. Topic topic = 1;
  109. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  110. }
  111. message BrokerPartitionAssignment {
  112. Partition partition = 1;
  113. string leader_broker = 2;
  114. repeated string follower_brokers = 3;
  115. }
  116. message RequestTopicPartitionsRequest {
  117. Topic topic = 1;
  118. int32 partition_count = 2;
  119. }
  120. message RequestTopicPartitionsResponse {
  121. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  122. }
  123. message AssignTopicPartitionsRequest {
  124. Topic topic = 1;
  125. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  126. bool is_leader = 3;
  127. }
  128. message AssignTopicPartitionsResponse {
  129. }
  130. message CheckTopicPartitionsStatusRequest {
  131. string namespace = 1;
  132. string topic = 2;
  133. BrokerPartitionAssignment broker_partition_assignment = 3;
  134. bool should_cancel_if_not_match = 4;
  135. }
  136. message CheckTopicPartitionsStatusResponse {
  137. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  138. }
  139. //////////////////////////////////////////////////
  140. message DataMessage {
  141. bytes key = 1;
  142. bytes value = 2;
  143. }
  144. message PublishRequest {
  145. message InitMessage {
  146. Topic topic = 1;
  147. Partition partition = 2;
  148. int32 ack_interval = 3;
  149. }
  150. oneof message {
  151. InitMessage init = 1;
  152. DataMessage data = 2;
  153. }
  154. int64 sequence = 3;
  155. }
  156. message PublishResponse {
  157. int64 ack_sequence = 1;
  158. string error = 2;
  159. string redirect_to_broker = 3;
  160. }
  161. message SubscribeRequest {
  162. message Consumer {
  163. string consumer_group = 1;
  164. string consumer_id = 2;
  165. string client_id = 3;
  166. }
  167. message Cursor {
  168. Topic topic = 1;
  169. Partition partition = 2;
  170. oneof offset {
  171. int64 start_offset = 3;
  172. int64 start_timestamp_ns = 4;
  173. }
  174. string filter = 5;
  175. }
  176. Consumer consumer = 1;
  177. Cursor cursor = 2;
  178. }
  179. message SubscribeResponse {
  180. message CtrlMessage {
  181. string error = 1;
  182. string redirect_to_broker = 2;
  183. }
  184. oneof message {
  185. CtrlMessage ctrl = 1;
  186. DataMessage data = 2;
  187. }
  188. }