refactor/remove-cluster-id: (#220)

### Remove `cluster_id` Field from Protocol Buffers

 - **Removed `cluster_id` Field**: The `cluster_id` field has been removed from the `RequestHeader` and `ResponseHeader` messages across multiple langua
 bindings and source files. This includes updates to:
   - C++: `common.pb.cc`, `common.pb.h`
   - Go: `common.pb.go`
   - Java: `Common.java`
   - Proto: `common.proto`
   - Rust: `meta.rs`

 These changes streamline the protocol by eliminating the `cluster_id` field, simplifying the message structures and related logic.
This commit is contained in:
Lei, HUANG
2025-03-04 11:17:59 +08:00
committed by GitHub
parent f8bd7fabb9
commit d92c9ac4e9
6 changed files with 82 additions and 422 deletions
+5 -17
View File
@@ -59,14 +59,9 @@ impl Eq for Peer {}
impl RequestHeader {
#[inline]
pub fn new(
(cluster_id, member_id): (u64, u64),
role: Role,
tracing_context: HashMap<String, String>,
) -> Self {
pub fn new(member_id: u64, role: Role, tracing_context: HashMap<String, String>) -> Self {
Self {
protocol_version: PROTOCOL_VERSION,
cluster_id,
member_id,
role: role.into(),
tracing_context,
@@ -76,19 +71,17 @@ impl RequestHeader {
impl ResponseHeader {
#[inline]
pub fn success(cluster_id: u64) -> Self {
pub fn success() -> Self {
Self {
protocol_version: PROTOCOL_VERSION,
cluster_id,
..Default::default()
}
}
#[inline]
pub fn failed(cluster_id: u64, error: Error) -> Self {
pub fn failed(error: Error) -> Self {
Self {
protocol_version: PROTOCOL_VERSION,
cluster_id,
error: Some(error),
}
}
@@ -145,23 +138,18 @@ macro_rules! gen_set_header {
#[inline]
pub fn set_header(
&mut self,
(cluster_id, member_id): (u64, u64),
member_id: u64,
role: Role,
tracing_context: HashMap<String, String>,
) {
match self.header.as_mut() {
Some(header) => {
header.cluster_id = cluster_id;
header.member_id = member_id;
header.role = role.into();
header.tracing_context = tracing_context;
}
None => {
self.header = Some(RequestHeader::new(
(cluster_id, member_id),
role,
tracing_context,
));
self.header = Some(RequestHeader::new(member_id, role, tracing_context));
}
}
}