Skip to content
Snippets Groups Projects
Commit 94dd3724 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon: Committed by Georgy Moshkin
Browse files

refactor: more informative Debug for Entry

parent 09b756a6
No related branches found
No related tags found
1 merge request!149Refactor/minor fixes
......@@ -91,7 +91,7 @@ impl Peer {}
/// See correspondig definition in `raft-rs`:
/// - <https://github.com/tikv/raft-rs/blob/v0.6.0/proto/proto/eraftpb.proto#L23>
///
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Serialize, Deserialize, PartialEq)]
pub struct Entry {
/// ```
/// enum EntryType {
......@@ -112,6 +112,21 @@ pub struct Entry {
pub context: Option<EntryContext>,
}
impl std::fmt::Debug for Entry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Entry")
.field(
"entry_type",
&raft::EntryType::from_i32(self.entry_type).ok_or(self.entry_type),
)
.field("index", &self.index)
.field("term", &self.term)
.field("data", &self.data)
.field("context", &self.context)
.finish()
}
}
/// Raft entry payload specific to the Picodata.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment