123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- syntax = "proto3";
- package messaging_pb;
- option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb";
- option java_package = "seaweedfs.mq";
- option java_outer_classname = "MessagQueueProto";
- //////////////////////////////////////////////////
- service SeaweedMessaging {
- // control plane
- rpc FindBrokerLeader (FindBrokerLeaderRequest) returns (FindBrokerLeaderResponse) {
- }
- rpc AssignSegmentBrokers (AssignSegmentBrokersRequest) returns (AssignSegmentBrokersResponse) {
- }
- rpc CheckSegmentStatus (CheckSegmentStatusRequest) returns (CheckSegmentStatusResponse) {
- }
- rpc CheckBrokerLoad (CheckBrokerLoadRequest) returns (CheckBrokerLoadResponse) {
- }
- // control plane for balancer
- rpc ConnectToBalancer (stream ConnectToBalancerRequest) returns (stream ConnectToBalancerResponse) {
- }
- // control plane for topic partitions
- rpc LookupTopicBrokers (LookupTopicBrokersRequest) returns (LookupTopicBrokersResponse) {
- }
- rpc CreateTopic (CreateTopicRequest) returns (CreateTopicResponse) {
- }
- rpc DoCreateTopic (DoCreateTopicRequest) returns (DoCreateTopicResponse) {
- }
- 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) {
- }
- rpc CreateTableSnapshot (CreateTableSnapshotRequest) returns (CreateTableSnapshotResponse) {
- }
- rpc CheckJobStatus (CheckJobStatusRequest) returns (CheckJobStatusResponse) {
- }
- // data plane
- rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
- }
- rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
- }
- }
- message CreateTableSnapshotRequest {
- string database_name = 1;
- string table_name = 2;
- string s3_directory = 3;
- string aws_access_key_id = 4;
- string aws_secret_access_key = 5;
- }
- enum JobStatus {
- JOB_STATUS_UNKNOWN = 0;
- JOB_STATUS_CREATED = 1;
- JOB_STATUS_FAILED = 2; // the error will be reported in the error string
- JOB_STATUS_TRY_LATER = 3; // when the cluster has other snapshots in progress
- JOB_STATUS_RUNNING = 4;
- JOB_STATUS_DONE = 5;
- }
- message CreateTableSnapshotResponse {
- string job_id = 1;
- JobStatus status = 2;
- string error = 3;
- }
- message CheckJobStatusRequest {
- string job_id = 1;
- }
- message CheckJobStatusResponse {
- JobStatus status = 1;
- string error = 2;
- }
- //////////////////////////////////////////////////
- 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;
- }
- //////////////////////////////////////////////////
- message FindBrokerLeaderRequest {
- string filer_group = 1;
- }
- message FindBrokerLeaderResponse {
- string broker = 1;
- }
- message Topic {
- string namespace = 1;
- string name = 2;
- }
- 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;
- }
- //////////////////////////////////////////////////
- message BrokerStats {
- int32 cpu_usage_percent = 1;
- map<string, TopicPartitionStats> stats = 2;
- }
- message TopicPartitionStats {
- Topic topic = 1;
- Partition partition = 2;
- int32 consumer_count = 3;
- bool is_leader = 4;
- }
- message ConnectToBalancerRequest {
- message InitMessage {
- string broker = 1;
- }
- oneof message {
- InitMessage init = 1;
- BrokerStats stats = 2;
- }
- }
- message ConnectToBalancerResponse {
- }
- //////////////////////////////////////////////////
- message CreateTopicRequest {
- Topic topic = 1;
- int32 partition_count = 2;
- }
- message CreateTopicResponse {
- repeated BrokerPartitionAssignment broker_partition_assignments = 2;
- }
- message DoCreateTopicRequest {
- Topic topic = 1;
- Partition partition = 2;
- }
- message DoCreateTopicResponse {
- }
- message ListTopicsRequest {
- }
- message ListTopicsResponse {
- repeated Topic topics = 1;
- }
- message LookupTopicBrokersRequest {
- Topic topic = 1;
- bool is_for_publish = 2;
- }
- message LookupTopicBrokersResponse {
- Topic topic = 1;
- repeated BrokerPartitionAssignment broker_partition_assignments = 2;
- }
- 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 {
- repeated BrokerPartitionAssignment broker_partition_assignments = 1;
- }
- message AssignTopicPartitionsRequest {
- Topic topic = 1;
- repeated BrokerPartitionAssignment broker_partition_assignments = 2;
- bool is_leader = 3;
- }
- message AssignTopicPartitionsResponse {
- }
- message CheckTopicPartitionsStatusRequest {
- string namespace = 1;
- string topic = 2;
- BrokerPartitionAssignment broker_partition_assignment = 3;
- bool should_cancel_if_not_match = 4;
- }
- message CheckTopicPartitionsStatusResponse {
- repeated BrokerPartitionAssignment broker_partition_assignments = 1;
- }
- //////////////////////////////////////////////////
- message DataMessage {
- bytes key = 1;
- bytes value = 2;
- }
- message PublishRequest {
- message InitMessage {
- Topic topic = 1;
- Partition partition = 2;
- int32 ack_interval = 3;
- }
- oneof message {
- InitMessage init = 1;
- DataMessage data = 2;
- }
- int64 sequence = 3;
- }
- message PublishResponse {
- int64 ack_sequence = 1;
- string error = 2;
- string redirect_to_broker = 3;
- }
- message SubscribeRequest {
- message Consumer {
- string consumer_group = 1;
- string consumer_id = 2;
- string client_id = 3;
- }
- message Cursor {
- Topic topic = 1;
- Partition partition = 2;
- oneof offset {
- int64 start_offset = 3;
- int64 start_timestamp_ns = 4;
- }
- string filter = 5;
- }
- Consumer consumer = 1;
- Cursor cursor = 2;
- }
- message SubscribeResponse {
- message CtrlMessage {
- string error = 1;
- string redirect_to_broker = 2;
- }
- oneof message {
- CtrlMessage ctrl = 1;
- DataMessage data = 2;
- }
- }
|