seaweedfs/weed/pb/mq.proto

245 lines
6 KiB
Protocol Buffer
Raw Normal View History

2020-04-16 09:21:23 +00:00
syntax = "proto3";
package messaging_pb;
option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb";
2022-07-03 07:29:25 +00:00
option java_package = "seaweedfs.mq";
option java_outer_classname = "MessagQueueProto";
2020-04-16 09:21:23 +00:00
//////////////////////////////////////////////////
service SeaweedMessaging {
2022-07-31 20:23:44 +00:00
// control plane
2022-07-11 07:20:27 +00:00
rpc FindBrokerLeader (FindBrokerLeaderRequest) returns (FindBrokerLeaderResponse) {
}
rpc AssignSegmentBrokers (AssignSegmentBrokersRequest) returns (AssignSegmentBrokersResponse) {
}
rpc CheckSegmentStatus (CheckSegmentStatusRequest) returns (CheckSegmentStatusResponse) {
}
rpc CheckBrokerLoad (CheckBrokerLoadRequest) returns (CheckBrokerLoadResponse) {
2020-05-05 09:05:28 +00:00
}
2023-09-15 06:49:05 +00:00
// control plane for balancer
rpc ConnectToBalancer (stream ConnectToBalancerRequest) returns (stream ConnectToBalancerResponse) {
}
// control plane for topic partitions
2023-08-28 01:59:04 +00:00
rpc LookupTopicBrokers (LookupTopicBrokersRequest) returns (LookupTopicBrokersResponse) {
}
2023-09-26 22:17:33 +00:00
rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
2023-09-24 21:22:11 +00:00
}
2023-09-26 22:17:33 +00:00
rpc DoConfigureTopic (DoConfigureTopicRequest) returns (DoConfigureTopicResponse) {
2023-09-24 22:26:49 +00:00
}
2023-09-25 04:19:51 +00:00
rpc ListTopics (ListTopicsRequest) returns (ListTopicsResponse) {
}
// a pub client will call this to get the topic partitions assignment
rpc RequestTopicPartitions (RequestTopicPartitionsRequest) returns (RequestTopicPartitionsResponse) {
}
rpc AssignTopicPartitions (AssignTopicPartitionsRequest) returns (AssignTopicPartitionsResponse) {
}
rpc CheckTopicPartitionsStatus (CheckTopicPartitionsStatusRequest) returns (CheckTopicPartitionsStatusResponse) {
}
2022-07-31 20:23:44 +00:00
// data plane
rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
}
2023-08-27 20:13:14 +00:00
rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
2023-08-26 20:39:21 +00:00
}
2020-04-16 09:21:23 +00:00
}
2022-07-16 17:49:34 +00:00
//////////////////////////////////////////////////
message SegmentInfo {
Segment segment = 1;
int64 start_ts_ns = 2;
repeated string brokers = 3;
int64 stop_ts_ns = 4;
repeated int32 previous_segments = 5;
repeated int32 next_segments = 6;
}
2020-04-16 09:21:23 +00:00
//////////////////////////////////////////////////
2022-07-10 19:11:37 +00:00
message FindBrokerLeaderRequest {
2022-07-11 07:20:27 +00:00
string filer_group = 1;
2020-05-05 09:05:28 +00:00
}
2022-07-10 19:11:37 +00:00
message FindBrokerLeaderResponse {
2020-05-05 09:05:28 +00:00
string broker = 1;
}
2022-07-11 07:20:27 +00:00
message Topic {
string namespace = 1;
string name = 2;
}
2022-07-11 07:20:27 +00:00
message Partition {
int32 ring_size = 1;
int32 range_start = 2;
int32 range_stop = 3;
}
message Segment {
string namespace = 1;
string topic = 2;
int32 id = 3;
Partition partition = 4;
}
message AssignSegmentBrokersRequest {
Segment segment = 1;
}
message AssignSegmentBrokersResponse {
repeated string brokers = 1;
}
message CheckSegmentStatusRequest {
Segment segment = 1;
}
message CheckSegmentStatusResponse {
bool is_active = 1;
}
message CheckBrokerLoadRequest {
}
message CheckBrokerLoadResponse {
int64 message_count = 1;
int64 bytes_count = 2;
}
2022-07-31 20:23:44 +00:00
2023-09-15 06:49:05 +00:00
//////////////////////////////////////////////////
message BrokerStats {
2023-09-19 21:02:08 +00:00
int32 cpu_usage_percent = 1;
map<string, TopicPartitionStats> stats = 2;
2023-09-15 06:49:05 +00:00
}
2023-09-19 21:02:08 +00:00
message TopicPartitionStats {
Topic topic = 1;
Partition partition = 2;
int32 consumer_count = 3;
bool is_leader = 4;
}
2023-09-15 06:49:05 +00:00
message ConnectToBalancerRequest {
message InitMessage {
string broker = 1;
}
oneof message {
InitMessage init = 1;
BrokerStats stats = 2;
}
}
message ConnectToBalancerResponse {
}
//////////////////////////////////////////////////
2023-09-26 22:17:33 +00:00
message ConfigureTopicRequest {
2023-09-24 21:22:11 +00:00
Topic topic = 1;
int32 partition_count = 2;
}
2023-09-26 22:17:33 +00:00
message ConfigureTopicResponse {
2023-09-24 21:22:11 +00:00
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
}
2023-09-26 22:17:33 +00:00
message DoConfigureTopicRequest {
2023-09-24 22:26:49 +00:00
Topic topic = 1;
Partition partition = 2;
}
2023-09-26 22:17:33 +00:00
message DoConfigureTopicResponse {
2023-09-24 22:26:49 +00:00
}
2023-09-25 04:19:51 +00:00
message ListTopicsRequest {
}
message ListTopicsResponse {
repeated Topic topics = 1;
}
2023-08-28 01:59:04 +00:00
message LookupTopicBrokersRequest {
Topic topic = 1;
bool is_for_publish = 2;
}
2023-08-28 01:59:04 +00:00
message LookupTopicBrokersResponse {
Topic topic = 1;
2023-08-28 01:59:04 +00:00
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
}
2023-08-28 01:59:04 +00:00
message BrokerPartitionAssignment {
Partition partition = 1;
string leader_broker = 2;
repeated string follower_brokers = 3;
}
message RequestTopicPartitionsRequest {
Topic topic = 1;
int32 partition_count = 2;
}
message RequestTopicPartitionsResponse {
2023-08-28 01:59:04 +00:00
repeated BrokerPartitionAssignment broker_partition_assignments = 1;
}
message AssignTopicPartitionsRequest {
Topic topic = 1;
2023-08-28 01:59:04 +00:00
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
bool is_leader = 3;
}
message AssignTopicPartitionsResponse {
}
message CheckTopicPartitionsStatusRequest {
string namespace = 1;
string topic = 2;
2023-08-28 01:59:04 +00:00
BrokerPartitionAssignment broker_partition_assignment = 3;
bool should_cancel_if_not_match = 4;
}
message CheckTopicPartitionsStatusResponse {
2023-08-28 01:59:04 +00:00
repeated BrokerPartitionAssignment broker_partition_assignments = 1;
}
2022-07-31 20:23:44 +00:00
//////////////////////////////////////////////////
2023-08-26 20:39:21 +00:00
message DataMessage {
bytes key = 1;
bytes value = 2;
}
2022-07-31 20:23:44 +00:00
message PublishRequest {
message InitMessage {
2023-08-26 20:39:21 +00:00
Topic topic = 1;
Partition partition = 2;
2023-09-07 05:39:46 +00:00
int32 ack_interval = 3;
}
oneof message {
InitMessage init = 1;
DataMessage data = 2;
}
int64 sequence = 3;
2022-07-31 20:23:44 +00:00
}
message PublishResponse {
int64 ack_sequence = 1;
string error = 2;
2023-08-28 00:50:59 +00:00
string redirect_to_broker = 3;
2022-07-31 20:23:44 +00:00
}
2023-08-26 20:39:21 +00:00
message SubscribeRequest {
2023-09-01 07:36:51 +00:00
message Consumer {
string consumer_group = 1;
string consumer_id = 2;
2023-09-05 04:43:50 +00:00
string client_id = 3;
2023-09-01 07:36:51 +00:00
}
message Cursor {
2023-08-26 20:39:21 +00:00
Topic topic = 1;
Partition partition = 2;
2023-09-01 07:36:51 +00:00
oneof offset {
int64 start_offset = 3;
int64 start_timestamp_ns = 4;
}
2023-09-05 04:43:50 +00:00
string filter = 5;
2023-08-26 20:39:21 +00:00
}
2023-09-01 07:36:51 +00:00
Consumer consumer = 1;
Cursor cursor = 2;
2023-08-26 20:39:21 +00:00
}
message SubscribeResponse {
message CtrlMessage {
string error = 1;
string redirect_to_broker = 2;
}
oneof message {
CtrlMessage ctrl = 1;
DataMessage data = 2;
}
}