You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2022/03/21 07:02:28 UTC

[rocketmq-apis] branch v2 updated: Remove unused messages

This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/rocketmq-apis.git


The following commit(s) were added to refs/heads/v2 by this push:
     new 8ab99f1  Remove unused messages
8ab99f1 is described below

commit 8ab99f19b405464d4688cd6bd7b255390ef7573b
Author: Li Zhanhui <li...@gmail.com>
AuthorDate: Mon Mar 21 07:02:12 2022 +0000

    Remove unused messages
---
 StyleGuide.md                       |   5 ++
 apache/rocketmq/v2/definition.proto | 157 +++++++++++++++---------------------
 apache/rocketmq/v2/service.proto    |  99 ++---------------------
 3 files changed, 76 insertions(+), 185 deletions(-)

diff --git a/StyleGuide.md b/StyleGuide.md
new file mode 100644
index 0000000..540e4bf
--- /dev/null
+++ b/StyleGuide.md
@@ -0,0 +1,5 @@
+https://developers.google.com/protocol-buffers/docs/style
+https://dev.bostondynamics.com/docs/protos/style_guide
+
+In addition to rules described above, Field Number Range [0, 64] are **exclusively** reserved for RocketMQ. 
+Third party entities are advised to used numbers greater than 64.
\ No newline at end of file
diff --git a/apache/rocketmq/v2/definition.proto b/apache/rocketmq/v2/definition.proto
index 5e2d948..99d0b1e 100644
--- a/apache/rocketmq/v2/definition.proto
+++ b/apache/rocketmq/v2/definition.proto
@@ -27,27 +27,35 @@ option java_generate_equals_and_hash = true;
 option java_string_check_utf8 = true;
 option java_outer_classname = "MQDomain";
 
-enum Permission {
-  NONE = 0;
-  READ = 1;
-  WRITE = 2;
-  READ_WRITE = 3;
+enum TransactionResolution {
+  TRANSACTION_RESOLUTION_UNSPECIFIED = 0;
+  COMMIT = 1;
+  ROLLBACK = 2;
+}
 
-  reserved 4 to 64;
+enum TransactionSource {
+  SOURCE_UNSPECIFIED = 0;
+  SOURCE_CLIENT = 1;
+  SOURCE_SERVER_CHECK = 2;
 }
 
-enum FilterType {
-  TAG = 0;
-  SQL = 1;
+enum Permission {
+  PERMISSION_UNSPECIFIED = 0;
+  NONE = 1;
+  READ = 2;
+  WRITE = 3;
+  READ_WRITE = 4;
+}
 
-  reserved 2 to 64;
+enum FilterType {
+  FILTER_TYPE_UNSPECIFIED = 0;
+  TAG = 1;
+  SQL = 2;
 }
 
 message FilterExpression {
   FilterType type = 1;
   string expression = 2;
-
-  reserved 3 to 64;
 }
 
 // Dead lettering is done on a best effort basis. The same message might be
@@ -62,8 +70,6 @@ message DeadLetterPolicy {
   //
   // If this parameter is 0, a default value of 16 is used.
   int32 max_delivery_attempts = 1;
-
-  reserved 2 to 64;
 }
 
 message Resource {
@@ -72,37 +78,30 @@ message Resource {
   // Resource name identifier, which remains unique within the abstract resource
   // namespace.
   string name = 2;
-
-  reserved 3 to 64;
 }
 
-enum ConsumeModel {
-  CLUSTERING = 0;
-  BROADCASTING = 1;
+enum ConsumePolicy {
+  CONSUME_POLICY_UNSPECIFIED = 0;
+  
+  // Clients are expecting to resume, continuing from positions where they previously progressed.
+  // Normally, servers shall save `offsets` for each client.
+  RESUME = 1;
 
-  reserved 2 to 64;
-}
+  // Clients using this policy expects servers to deliver all existing messages, ignoring previous progress made. 
+  PLAYBACK = 2;
 
-message ProducerData {
-  Resource group = 1;
+  // Clients using this policy expects servers to discard all existings messages and deliver messages that arrives 
+  // after the connection is established.
+  DISCARD = 3;
 
-  reserved 2 to 64;
-}
-
-enum ConsumePolicy {
-  RESUME = 0;
-  PLAYBACK = 1;
-  DISCARD = 2;
-  TARGET_TIMESTAMP = 3;
-
-  reserved 4 to 64;
+  // Clients accepts messages whose `born_time` is equal or greater than specified timestamp.
+  TARGET_TIMESTAMP = 4;
 }
 
 enum ConsumeMessageType {
-  ACTIVE = 0;
-  PASSIVE = 1;
-
-  reserved 2 to 64;
+  CONSUME_MESSAGE_TYPE_UNSPECIFIED = 0;
+  ACTIVE = 1;
+  PASSIVE = 2;
 }
 
 message ConsumerData {
@@ -110,44 +109,33 @@ message ConsumerData {
 
   repeated SubscriptionEntry subscriptions = 2;
 
-  ConsumeModel consume_model = 3;
-
-  ConsumePolicy consume_policy = 4;
+  ConsumePolicy consume_policy = 3;
 
-  DeadLetterPolicy dead_letter_policy = 5;
+  DeadLetterPolicy dead_letter_policy = 4;
 
-  ConsumeMessageType consume_type = 6;
-
-  reserved 7 to 64;
+  ConsumeMessageType consume_type = 5;
 }
 
 message SubscriptionEntry {
   Resource topic = 1;
   FilterExpression expression = 2;
-
-  reserved 3 to 64;
 }
 
 enum AddressScheme {
-  IPv4 = 0;
-  IPv6 = 1;
-  DOMAIN_NAME = 2;
-
-  reserved 3 to 64;
+  ADDRESS_SCHEME_UNSPECIFIED = 0;
+  IPv4 = 1;
+  IPv6 = 2;
+  DOMAIN_NAME = 3;
 }
 
 message Address {
   string host = 1;
   int32 port = 2;
-
-  reserved 3 to 64;
 }
 
 message Endpoints {
   AddressScheme scheme = 1;
   repeated Address addresses = 2;
-
-  reserved 3 to 64;
 }
 
 message Broker {
@@ -163,8 +151,6 @@ message Broker {
   // 2. ipv4:address[:port][,address[:port],...] – IPv4 addresses
   // 3. ipv6:address[:port][,address[:port],...] – IPv6 addresses
   Endpoints endpoints = 3;
-
-  reserved 4 to 64;
 }
 
 message Partition {
@@ -173,40 +159,37 @@ message Partition {
   Permission permission = 3;
   Broker broker = 4;
   repeated MessageType accept_message_types = 5;
-
-  reserved 6 to 64;
 }
 
 enum MessageType {
-  NORMAL = 0;
+  MESSAGE_TYPE_UNSPECIFIED = 0;
+
+  NORMAL = 1;
 
   // Sequenced message
-  FIFO = 1;
+  FIFO = 2;
 
   // Messages that are delivered after the specified duration.
-  DELAY = 2;
+  DELAY = 3;
 
   // Messages that are transactional. Only committed messages are delivered to
   // subscribers.
-  TRANSACTION = 3;
-
-  reserved 4 to 64;
+  TRANSACTION = 4;
 }
 
 enum DigestType {
+  UNKNOWN = 0;
   // CRC algorithm achieves goal of detecting random data error with lowest
   // computation overhead.
-  CRC32 = 0;
+  CRC32 = 1;
 
   // MD5 algorithm achieves good balance between collision rate and computation
   // overhead.
-  MD5 = 1;
+  MD5 = 2;
 
   // SHA-family has substantially fewer collision with fair amount of
   // computation.
-  SHA1 = 2;
-
-  reserved 3 to 64;
+  SHA1 = 3;
 }
 
 // When publishing messages to or subscribing messages from brokers, clients
@@ -227,15 +210,14 @@ enum DigestType {
 message Digest {
   DigestType type = 1;
   string checksum = 2;
-
-  reserved 3 to 64;
 }
 
 enum Encoding {
-  IDENTITY = 0;
-  GZIP = 1;
+  ENCODING_UNSPECIFIED = 0;
 
-  reserved 2 to 64;
+  IDENTITY = 1;
+
+  GZIP = 2;
 }
 
 message SystemAttribute {
@@ -299,18 +281,13 @@ message SystemAttribute {
   // the attempt is 1 not 0 if message is delivered first time.
   int32 delivery_attempt = 17;
 
-  // Message producer load-balance group if applicable.
-  Resource producer_group = 18;
-
-  string message_group = 19;
+  string message_group = 18;
 
   // Trace context.
-  string trace_context = 20;
+  string trace_context = 19;
 
   // Delay time of first recover orphaned transaction request from server.
-  google.protobuf.Duration orphaned_transaction_recovery_period = 21;
-
-  reserved 22 to 64;
+  google.protobuf.Duration orphaned_transaction_recovery_period = 20;
 }
 
 message Message {
@@ -327,25 +304,21 @@ message Message {
   SystemAttribute system_attribute = 3;
 
   bytes body = 4;
-
-  reserved 5 to 64;
 }
 
 message Assignment {
   Partition Partition = 1;
-
-  reserved 2 to 64;
 }
 
 enum QueryOffsetPolicy {
+  QUERY_OFFSET_POLICY_UNSPECIFIED = 0;
+  
   // Use this option if client wishes to playback all existing messages.
-  BEGINNING = 0;
+  BEGINNING = 1;
 
   // Use this option if client wishes to skip all existing messages.
-  END = 1;
+  END = 2;
 
   // Use this option if time-based seek is targeted.
-  TIME_POINT = 2;
-
-  reserved 3 to 64;
+  TIME_POINT = 3;
 }
\ No newline at end of file
diff --git a/apache/rocketmq/v2/service.proto b/apache/rocketmq/v2/service.proto
index d3e4505..e7bc950 100644
--- a/apache/rocketmq/v2/service.proto
+++ b/apache/rocketmq/v2/service.proto
@@ -38,8 +38,6 @@ message ResponseCommon {
   google.rpc.RetryInfo retry_info = 4;
   google.rpc.DebugInfo debug_info = 5;
   google.rpc.ErrorInfo error_info = 6;
-
-  reserved 7 to 64;
 }
 
 // Topics are destination of messages to publish to or subscribe from. Similar
@@ -63,31 +61,23 @@ message QueryRouteRequest {
   Resource topic = 1;
 
   Endpoints endpoints = 2;
-
-  reserved 3 to 64;
 }
 
 message QueryRouteResponse {
   ResponseCommon common = 1;
 
   repeated Partition partitions = 2;
-
-  reserved 3 to 64;
 }
 
 message SendMessageRequest {
   Message message = 1;
   Partition partition = 2;
-
-  reserved 3 to 64;
 }
 
 message SendMessageResponse {
   ResponseCommon common = 1;
   string message_id = 2;
   string transaction_id = 3;
-
-  reserved 4 to 64;
 }
 
 message QueryAssignmentRequest {
@@ -97,15 +87,11 @@ message QueryAssignmentRequest {
 
   // Service access point
   Endpoints endpoints = 4;
-
-  reserved 5 to 64;
 }
 
 message QueryAssignmentResponse {
   ResponseCommon common = 1;
   repeated Assignment assignments = 2;
-
-  reserved 3 to 64;
 }
 
 message ReceiveMessageRequest {
@@ -119,8 +105,6 @@ message ReceiveMessageRequest {
   google.protobuf.Duration invisible_duration = 8;
   google.protobuf.Duration await_time = 9;
   bool fifo_flag = 10;
-
-  reserved 11 to 64;
 }
 
 message ReceiveMessageResponse {
@@ -128,8 +112,6 @@ message ReceiveMessageResponse {
   repeated Message messages = 2;
   google.protobuf.Timestamp delivery_timestamp = 3;
   google.protobuf.Duration invisible_duration = 4;
-
-  reserved 5 to 64;
 }
 
 message AckMessageRequest {
@@ -141,14 +123,10 @@ message AckMessageRequest {
     int64 offset = 5;
   }
   string message_id = 6;
-
-  reserved 7 to 64;
 }
 
 message AckMessageResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message NackMessageRequest {
@@ -159,14 +137,10 @@ message NackMessageRequest {
   string message_id = 5;
   int32 delivery_attempt = 6;
   int32 max_delivery_attempts = 7;
-
-  reserved 8 to 64;
 }
 
 message NackMessageResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message ForwardMessageToDeadLetterQueueRequest {
@@ -177,84 +151,53 @@ message ForwardMessageToDeadLetterQueueRequest {
   string message_id = 5;
   int32 delivery_attempt = 6;
   int32 max_delivery_attempts = 7;
-
-  reserved 8 to 64;
 }
 
 message ForwardMessageToDeadLetterQueueResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message HeartbeatRequest {
   string client_id = 1;
-  oneof client_data {
-    ProducerData producer_data = 2;
-    ConsumerData consumer_data = 3;
-  }
-  bool fifo_flag = 4;
-
-  reserved 5 to 64;
+  ConsumerData consumer_data = 2;
+  bool fifo_flag = 3;
 }
 
 message HeartbeatResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message HealthCheckRequest {
   Resource group = 1;
   string client_host = 2;
-
-  reserved 3 to 64;
 }
 
 message HealthCheckResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message EndTransactionRequest {
   Resource group = 1;
   string message_id = 2;
   string transaction_id = 3;
-  enum TransactionResolution {
-    COMMIT = 0;
-    ROLLBACK = 1;
-  }
   TransactionResolution resolution = 4;
-  enum Source {
-    CLIENT = 0;
-    SERVER_CHECK = 1;
-  }
-  Source source = 5;
+  TransactionSource source = 5;
   string trace_context = 6;
-
-  reserved 7 to 64;
 }
 
 message EndTransactionResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message QueryOffsetRequest {
   Partition partition = 1;
   QueryOffsetPolicy policy = 2;
   google.protobuf.Timestamp time_point = 3;
-
-  reserved 4 to 64;
 }
 
 message QueryOffsetResponse {
   ResponseCommon common = 1;
   int64 offset = 2;
-
-  reserved 3 to 64;
 }
 
 message PullMessageRequest {
@@ -265,8 +208,6 @@ message PullMessageRequest {
   google.protobuf.Duration await_time = 5;
   FilterExpression filter_expression = 6;
   string client_id = 7;
-
-  reserved 8 to 64;
 }
 
 message PullMessageResponse {
@@ -275,53 +216,37 @@ message PullMessageResponse {
   int64 next_offset = 3;
   int64 max_offset = 4;
   repeated Message messages = 5;
-
-  reserved 6 to 64;
 }
 
 message PrintThreadStackTraceCommand {
   int64 command_id = 1;
-  reserved 2 to 64;
 }
 
 message ThreadStackTrace {
   int64 command_id = 1;
   string thread_stack_trace = 2;
-
-  reserved 3 to 64;
 }
 
 message VerifyMessageCommand {
   int64 command_id = 1;
   Message message = 2;
-
-  reserved 3 to 64;
 }
 
 message VerifyMessageResult {
   int64 command_id = 1;
   ResponseCommon common = 2;
-
-  reserved 3 to 64;
 }
 
 message RecoverOrphanedTransactionCommand {
   int64 command_id = 1;
   Message orphaned_transactional_message = 2;
   string transaction_id = 3;
-
-  reserved 4 to 64;
 }
 
 message Settings {
   string client_id = 1;
   repeated Resource topics = 2;
-  oneof group {
-    Resource producer_group = 3;
-    Resource consumer_group = 4;
-  }
-
-  reserved 5 to 64;
+  Resource group = 3;
 }
 
 message TelemetryCommand {
@@ -342,24 +267,15 @@ message TelemetryCommand {
 
     VerifyMessageResult verify_message_result = 6;
   }
-
-  reserved 7 to 64;
 }
 
 message NotifyClientTerminationRequest {
-  oneof group {
-    Resource producer_group = 1;
-    Resource consumer_group = 2;
-  }
-  string client_id = 3;
-
-  reserved 4 to 64;
+  Resource group = 1;
+  string client_id = 2;
 }
 
 message NotifyClientTerminationResponse {
   ResponseCommon common = 1;
-
-  reserved 2 to 64;
 }
 
 message ChangeInvisibleDurationRequest {
@@ -371,7 +287,6 @@ message ChangeInvisibleDurationRequest {
 
   // New invisible duration
   google.protobuf.Duration invisible_duration = 4;
-  reserved 5 to 64;
 }
 
 message ChangeInvisibleDurationResponse {
@@ -379,8 +294,6 @@ message ChangeInvisibleDurationResponse {
 
   // Server may generate a new receipt handle for the message.
   string receipt_handle = 2;
-
-  reserved 3 to 64;
 }
 
 // For all the RPCs in MessagingService, the following error handling policies