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.

215 lines
5.3 KiB

3 years ago
3 years ago
3 years ago
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
1 year ago
1 year ago
3 years ago
3 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. int64 message_count = 2;
  89. int64 bytes_count = 3;
  90. int32 cpu_usage_percent = 4;
  91. }
  92. message ConnectToBalancerRequest {
  93. message InitMessage {
  94. string broker = 1;
  95. }
  96. oneof message {
  97. InitMessage init = 1;
  98. BrokerStats stats = 2;
  99. }
  100. }
  101. message ConnectToBalancerResponse {
  102. string error = 1;
  103. }
  104. //////////////////////////////////////////////////
  105. message LookupTopicBrokersRequest {
  106. Topic topic = 1;
  107. bool is_for_publish = 2;
  108. }
  109. message LookupTopicBrokersResponse {
  110. Topic topic = 1;
  111. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  112. }
  113. message BrokerPartitionAssignment {
  114. Partition partition = 1;
  115. string leader_broker = 2;
  116. repeated string follower_brokers = 3;
  117. }
  118. message RequestTopicPartitionsRequest {
  119. Topic topic = 1;
  120. int32 partition_count = 2;
  121. }
  122. message RequestTopicPartitionsResponse {
  123. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  124. }
  125. message AssignTopicPartitionsRequest {
  126. Topic topic = 1;
  127. repeated BrokerPartitionAssignment broker_partition_assignments = 2;
  128. bool is_leader = 3;
  129. }
  130. message AssignTopicPartitionsResponse {
  131. }
  132. message CheckTopicPartitionsStatusRequest {
  133. string namespace = 1;
  134. string topic = 2;
  135. BrokerPartitionAssignment broker_partition_assignment = 3;
  136. bool should_cancel_if_not_match = 4;
  137. }
  138. message CheckTopicPartitionsStatusResponse {
  139. repeated BrokerPartitionAssignment broker_partition_assignments = 1;
  140. }
  141. //////////////////////////////////////////////////
  142. message DataMessage {
  143. bytes key = 1;
  144. bytes value = 2;
  145. }
  146. message PublishRequest {
  147. message InitMessage {
  148. Topic topic = 1;
  149. Partition partition = 2;
  150. int32 ack_interval = 3;
  151. }
  152. oneof message {
  153. InitMessage init = 1;
  154. DataMessage data = 2;
  155. }
  156. int64 sequence = 3;
  157. }
  158. message PublishResponse {
  159. int64 ack_sequence = 1;
  160. string error = 2;
  161. string redirect_to_broker = 3;
  162. }
  163. message SubscribeRequest {
  164. message Consumer {
  165. string consumer_group = 1;
  166. string consumer_id = 2;
  167. string client_id = 3;
  168. }
  169. message Cursor {
  170. Topic topic = 1;
  171. Partition partition = 2;
  172. oneof offset {
  173. int64 start_offset = 3;
  174. int64 start_timestamp_ns = 4;
  175. }
  176. string filter = 5;
  177. }
  178. Consumer consumer = 1;
  179. Cursor cursor = 2;
  180. }
  181. message SubscribeResponse {
  182. message CtrlMessage {
  183. string error = 1;
  184. string redirect_to_broker = 2;
  185. }
  186. oneof message {
  187. CtrlMessage ctrl = 1;
  188. DataMessage data = 2;
  189. }
  190. }