Created
September 1, 2020 11:56
-
-
Save Swarnim-singhal/c7921424f48b6edfca0b15c85db2c985 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GossipDigest implements Comparable<GossipDigest> { | |
final InetAddressAndPort endpoint; | |
final int generation; // generation stays the same when server is running and grows every time the node is started | |
final int maxVersion; // maximum version number is the biggest version number in EndPointState for this endpoint | |
GossipDigest(InetAddressAndPort ep, int gen, int version){ | |
endpoint = ep; | |
generation = gen; | |
maxVersion = version; | |
} | |
public int compareTo(GossipDigest gDigest){ | |
if (generation != gDigest.generation) | |
return (generation - gDigest.generation); | |
return (maxVersion - gDigest.maxVersion); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment