refactor(build): reformat code and add tonic health dependency

- Reformatted build script with proper indentation and line breaks
- Added tonic-health dependency to Cargo.toml and updated lock file
- Improved error handling in disk cache with concurrent deletion checks
- Refactored conditional chains using && and let expressions
- Reformatted struct initialization and function parameter lists
- Added proper spacing and alignment in language stats processing
- Improved assertion formatting in test cases
- Reorganized import statements and code layout in multiple files
- Updated metrics functions with better parameter handling and formatting
This commit is contained in:
zhenyi
2026-06-11 13:56:15 +08:00
parent c32a7cad2f
commit a40da90ef9
31 changed files with 696 additions and 417 deletions
+23 -4
View File
@@ -159,7 +159,6 @@ pub enum GitNodeMessage {
TriggerElection,
// ── Raft consensus messages ──────────────────────────────
/// AppendEntries RPC: Leader → Follower log replication.
#[rpc]
AppendEntries(AppendEntriesRequest, RpcReplyPort<AppendEntriesResponse>),
@@ -418,7 +417,16 @@ impl BytesConvertable for AppendEntriesRequest {
});
}
let leader_commit = read_u64(&bytes, &mut offset);
Self { version, term, leader_id, leader_grpc_addr, prev_log_index, prev_log_term, entries, leader_commit }
Self {
version,
term,
leader_id,
leader_grpc_addr,
prev_log_index,
prev_log_term,
entries,
leader_commit,
}
}
}
@@ -457,7 +465,14 @@ impl BytesConvertable for AppendEntriesResponse {
let match_index = read_u64(&bytes, &mut offset);
let conflict_index = read_u64(&bytes, &mut offset);
let conflict_term = read_u64(&bytes, &mut offset);
Self { version, term, success, match_index, conflict_index, conflict_term }
Self {
version,
term,
success,
match_index,
conflict_index,
conflict_term,
}
}
}
@@ -502,7 +517,11 @@ impl BytesConvertable for ReadIndexResponse {
let commit_index = read_u64(&bytes, &mut offset);
let leader_term = read_u64(&bytes, &mut offset);
let is_leader = bytes.get(offset).copied().unwrap_or(0) == 1;
Self { commit_index, leader_term, is_leader }
Self {
commit_index,
leader_term,
is_leader,
}
}
}