public class RoutingMechanism extends Object
| Constructor and Description |
|---|
RoutingMechanism(AtomicReferenceArray<FutureResponse> futureResponses,
FutureRouting futureRoutingResponse,
Collection<PeerFilter> peerFilters)
Creates the routing mechanism.
|
public RoutingMechanism(AtomicReferenceArray<FutureResponse> futureResponses, FutureRouting futureRoutingResponse, Collection<PeerFilter> peerFilters)
futureResponses - The current future responeses that are runningfutureRoutingResponse - The reponse future from this routing requestpublic FutureRouting futureRoutingResponse()
public int parallel()
public boolean isStopCreatingNewFutures()
public FutureResponse futureResponse(int i)
i - The number of the future response to getpublic FutureResponse futureResponse(int i, FutureResponse futureResponse)
i - The number of the future response to get and setfutureResponse - The future response to setpublic RoutingMechanism queueToAsk(NavigableSet<PeerAddress> queueToAsk)
queueToAsk - The queue that contains the peers that will be queried in the futurepublic NavigableSet<PeerAddress> queueToAsk()
public RoutingMechanism alreadyAsked(SortedSet<PeerAddress> alreadyAsked)
alreadyAsked - The peer we have already queried, we need to store them to not ask the same peers againpublic SortedSet<PeerAddress> alreadyAsked()
public RoutingMechanism potentialHits(NavigableSet<PeerAddress> potentialHits)
potentialHits - The potential hits are those reported by other peers that we did not check if they contain certain
data.public NavigableSet<PeerAddress> potentialHits()
public RoutingMechanism directHits(SortedMap<PeerAddress,DigestInfo> directHits)
directHits - The peers that have certain data stored on itpublic SortedMap<PeerAddress,DigestInfo> directHits()
public int getMaxDirectHits()
public void maxDirectHits(int maxDirectHits)
public int maxNoNewInfo()
public void maxNoNewInfo(int maxNoNewInfo)
public int maxFailures()
public void maxFailures(int maxFailures)
public int maxSucess()
public void maxSucess(int maxSucess)
public PeerAddress pollFirstInQueueToAsk()
public PeerAddress pollRandomInQueueToAsk(Random rnd)
public void addToAlreadyAsked(PeerAddress next)
public void neighbors(RoutingBuilder builder)
public void cancel()
public AtomicReferenceArray<FutureResponse> futureResponses()
public void addPotentialHits(PeerAddress remotePeer)
public void stopCreatingNewFutures(boolean stopCreatingNewFutures)
public boolean evaluateFailed()
public boolean evaluateSuccess(PeerAddress remotePeer, DigestInfo digestBean, Collection<PeerAddress> newNeighbors, boolean last, Number160 locationkey)
public int nrNoNewInfo()
Copyright © 2014. All rights reserved.