Last active
September 2, 2020 14:48
-
-
Save Swarnim-singhal/c7db4b50d2ab5e1fb361a281c019ef41 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 GossipDigestAck { | |
final List<GossipDigest> gDigestList; | |
final Map<InetAddressAndPort, EndpointState> epStateMap; | |
GossipDigestAck(List<GossipDigest> gDigestList, Map<InetAddressAndPort, EndpointState> epStateMap{ | |
this.gDigestList = gDigestList; | |
this.epStateMap = epStateMap; | |
} | |
} |
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 GossipDigestAckVerbHandler extends GossipVerbHandler<GossipDigestAck> { | |
public static final GossipDigestAckVerbHandler instance = new GossipDigestAckVerbHandler(); | |
public void doVerb(Message<GossipDigestAck> message) { | |
InetAddressAndPort from = message.from(); | |
GossipDigestAck gDigestAckMessage = message.payload; | |
List<GossipDigest> gDigestList = gDigestAckMessage.getGossipDigestList(); | |
Map<InetAddressAndPort, EndpointState> epStateMap = gDigestAckMessage.getEndpointStateMap(); | |
Map<InetAddressAndPort, EndpointState> deltaEpStateMap = new HashMap<InetAddressAndPort, EndpointState>(); | |
for (GossipDigest gDigest : gDigestList) | |
{ | |
InetAddressAndPort addr = gDigest.getEndpoint(); | |
EndpointState localEpStatePtr = Gossiper.instance.getStateForVersionBiggerThan(addr, gDigest.getMaxVersion()); | |
if (localEpStatePtr != null) | |
deltaEpStateMap.put(addr, localEpStatePtr); | |
} | |
// construct GossipDigestAck2Message and send it | |
Message<GossipDigestAck2> gDigestAck2Message = Message.out(GOSSIP_DIGEST_ACK2, new GossipDigestAck2(deltaEpStateMap)); | |
MessagingService.instance().send(gDigestAck2Message, from); | |
super.doVerb(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment