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.

165 lines
4.1 KiB

3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years 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. }
  31. //////////////////////////////////////////////////
  32. message SegmentInfo {
  33. Segment segment = 1;
  34. int64 start_ts_ns = 2;
  35. repeated string brokers = 3;
  36. int64 stop_ts_ns = 4;
  37. repeated int32 previous_segments = 5;
  38. repeated int32 next_segments = 6;
  39. }
  40. //////////////////////////////////////////////////
  41. message FindBrokerLeaderRequest {
  42. string filer_group = 1;
  43. }
  44. message FindBrokerLeaderResponse {
  45. string broker = 1;
  46. }
  47. message Topic {
  48. string namespace = 1;
  49. string name = 2;
  50. }
  51. message Partition {
  52. int32 ring_size = 1;
  53. int32 range_start = 2;
  54. int32 range_stop = 3;
  55. }
  56. message Segment {
  57. string namespace = 1;
  58. string topic = 2;
  59. int32 id = 3;
  60. Partition partition = 4;
  61. }
  62. message AssignSegmentBrokersRequest {
  63. Segment segment = 1;
  64. }
  65. message AssignSegmentBrokersResponse {
  66. repeated string brokers = 1;
  67. }
  68. message CheckSegmentStatusRequest {
  69. Segment segment = 1;
  70. }
  71. message CheckSegmentStatusResponse {
  72. bool is_active = 1;
  73. }
  74. message CheckBrokerLoadRequest {
  75. }
  76. message CheckBrokerLoadResponse {
  77. int64 message_count = 1;
  78. int64 bytes_count = 2;
  79. }
  80. message FindTopicBrokersRequest {
  81. Topic topic = 1;
  82. bool is_for_publish = 2;
  83. }
  84. message FindTopicBrokersResponse {
  85. Topic topic = 1;
  86. TopicPartitionsAssignment topic_partitions_assignment = 2;
  87. }
  88. message BrokerPartitionsAssignment {
  89. int32 partition_start = 1;
  90. int32 partition_stop = 2;
  91. string leader_broker = 3;
  92. repeated string follower_brokers = 4;
  93. }
  94. message TopicPartitionsAssignment {
  95. int32 partition_count = 1; // over-sharded partitions, usually 1024
  96. repeated BrokerPartitionsAssignment broker_partitions = 2;
  97. }
  98. message RequestTopicPartitionsRequest {
  99. Topic topic = 1;
  100. int32 partition_count = 2;
  101. }
  102. message RequestTopicPartitionsResponse {
  103. TopicPartitionsAssignment topic_partitions_assignment = 1;
  104. }
  105. message AssignTopicPartitionsRequest {
  106. Topic topic = 1;
  107. TopicPartitionsAssignment topic_partitions_assignment = 2;
  108. bool is_leader = 3;
  109. }
  110. message AssignTopicPartitionsResponse {
  111. }
  112. message CheckTopicPartitionsStatusRequest {
  113. string namespace = 1;
  114. string topic = 2;
  115. BrokerPartitionsAssignment broker_partitions_assignment = 3;
  116. bool should_cancel_if_not_match = 4;
  117. }
  118. message CheckTopicPartitionsStatusResponse {
  119. TopicPartitionsAssignment topic_partitions_assignment = 1;
  120. }
  121. //////////////////////////////////////////////////
  122. message PublishRequest {
  123. message InitMessage {
  124. Segment segment = 1;
  125. }
  126. message DataMessage {
  127. bytes key = 1;
  128. bytes value = 2;
  129. }
  130. oneof message {
  131. InitMessage init = 1;
  132. DataMessage data = 2;
  133. }
  134. int64 sequence = 3;
  135. }
  136. message PublishResponse {
  137. int64 ack_sequence = 1;
  138. string error = 2;
  139. bool is_closed = 3;
  140. }