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.

189 lines
4.6 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 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. }
  128. oneof message {
  129. InitMessage init = 1;
  130. DataMessage data = 2;
  131. }
  132. int64 sequence = 3;
  133. }
  134. message PublishResponse {
  135. int64 ack_sequence = 1;
  136. string error = 2;
  137. string redirect_to_broker = 3;
  138. }
  139. message SubscribeRequest {
  140. message Consumer {
  141. string consumer_group = 1;
  142. string consumer_id = 2;
  143. }
  144. message Cursor {
  145. Topic topic = 1;
  146. Partition partition = 2;
  147. oneof offset {
  148. int64 start_offset = 3;
  149. int64 start_timestamp_ns = 4;
  150. }
  151. }
  152. Consumer consumer = 1;
  153. Cursor cursor = 2;
  154. }
  155. message SubscribeResponse {
  156. message CtrlMessage {
  157. string error = 1;
  158. string redirect_to_broker = 2;
  159. }
  160. oneof message {
  161. CtrlMessage ctrl = 1;
  162. DataMessage data = 2;
  163. }
  164. }