Skip to content

Commit

Permalink
raft: remove unnecessary derives for node structs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgrinaker committed Jun 8, 2024
1 parent b048e8a commit a5628b4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/raft/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl From<RawNode<Leader>> for Node {
}

/// A Raft role: leader, follower, or candidate.
pub trait Role: Clone + std::fmt::Debug + PartialEq {}
pub trait Role {}

/// A Raft node with the concrete role R.
///
Expand Down Expand Up @@ -247,7 +247,6 @@ impl<R: Role> RawNode<R> {
}

/// A candidate is campaigning to become a leader.
#[derive(Clone, Debug, PartialEq)]
pub struct Candidate {
/// Votes received (including ourself).
votes: HashSet<NodeID>,
Expand Down Expand Up @@ -410,7 +409,6 @@ impl RawNode<Candidate> {
}

// A follower replicates state from a leader.
#[derive(Clone, Debug, PartialEq)]
pub struct Follower {
/// The leader, or None if just initialized.
leader: Option<NodeID>,
Expand Down Expand Up @@ -682,7 +680,6 @@ impl RawNode<Follower> {
}

/// Follower replication progress.
#[derive(Clone, Debug, PartialEq)]
struct Progress {
/// The next index to replicate to the follower.
next_index: Index,
Expand Down Expand Up @@ -726,7 +723,6 @@ impl Progress {
}

/// A pending client write request.
#[derive(Clone, Debug, PartialEq)]
struct Write {
/// The node which submitted the write.
from: NodeID,
Expand All @@ -735,7 +731,6 @@ struct Write {
}

/// A pending client read request.
#[derive(Clone, Debug, PartialEq)]
struct Read {
/// The sequence number of this read.
seq: ReadSequence,
Expand All @@ -748,7 +743,6 @@ struct Read {
}

// A leader serves requests and replicates the log to followers.
#[derive(Clone, Debug, PartialEq)]
pub struct Leader {
/// Follower replication progress.
progress: HashMap<NodeID, Progress>,
Expand Down

0 comments on commit a5628b4

Please sign in to comment.