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.

186 lines
4.5 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
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years 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 FindTopicBrokers (FindTopicBrokersRequest) returns (FindTopicBrokersResponse) {
  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 FindTopicBrokersRequest {
  83. Topic topic = 1;
  84. bool is_for_publish = 2;
  85. }
  86. message FindTopicBrokersResponse {
  87. Topic topic = 1;
  88. TopicPartitionsAssignment topic_partitions_assignment = 2;
  89. }
  90. message BrokerPartitionsAssignment {
  91. int32 partition_start = 1;
  92. int32 partition_stop = 2;
  93. string leader_broker = 3;
  94. repeated string follower_brokers = 4;
  95. }
  96. message TopicPartitionsAssignment {
  97. int32 partition_count = 1; // over-sharded partitions, usually 1024
  98. repeated BrokerPartitionsAssignment broker_partitions = 2;
  99. }
  100. message RequestTopicPartitionsRequest {
  101. Topic topic = 1;
  102. int32 partition_count = 2;
  103. }
  104. message RequestTopicPartitionsResponse {
  105. TopicPartitionsAssignment topic_partitions_assignment = 1;
  106. }
  107. message AssignTopicPartitionsRequest {
  108. Topic topic = 1;
  109. TopicPartitionsAssignment topic_partitions_assignment = 2;
  110. bool is_leader = 3;
  111. }
  112. message AssignTopicPartitionsResponse {
  113. }
  114. message CheckTopicPartitionsStatusRequest {
  115. string namespace = 1;
  116. string topic = 2;
  117. BrokerPartitionsAssignment broker_partitions_assignment = 3;
  118. bool should_cancel_if_not_match = 4;
  119. }
  120. message CheckTopicPartitionsStatusResponse {
  121. TopicPartitionsAssignment topic_partitions_assignment = 1;
  122. }
  123. //////////////////////////////////////////////////
  124. message DataMessage {
  125. bytes key = 1;
  126. bytes value = 2;
  127. }
  128. message PublishRequest {
  129. message InitMessage {
  130. Topic topic = 1;
  131. Partition partition = 2;
  132. }
  133. oneof message {
  134. InitMessage init = 1;
  135. DataMessage data = 2;
  136. }
  137. int64 sequence = 3;
  138. }
  139. message PublishResponse {
  140. int64 ack_sequence = 1;
  141. string error = 2;
  142. string redirect_to_broker = 3;
  143. }
  144. message SubscribeRequest {
  145. message InitMessage {
  146. Topic topic = 1;
  147. Partition partition = 2;
  148. }
  149. InitMessage init = 1;
  150. int64 sequence = 2;
  151. }
  152. message SubscribeResponse {
  153. message CtrlMessage {
  154. string error = 1;
  155. string redirect_to_broker = 2;
  156. }
  157. oneof message {
  158. CtrlMessage ctrl = 1;
  159. DataMessage data = 2;
  160. }
  161. }