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.

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