public class LocationManager extends java.lang.Object implements ByteCounter
Modifier and Type | Class and Description |
---|---|
class |
LocationManager.IncomingSwapRequestHandler
Similar to OutgoingSwapRequestHandler, except that we did
not initiate the SwapRequest.
|
class |
LocationManager.MyCallback |
class |
LocationManager.OutgoingSwapRequestHandler
Locks the LocationManager.
|
class |
LocationManager.SwapRequestSender
Sends an FNPSwapRequest every second unless the LM is locked
(which it will be most of the time)
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FOIL_PITCH_BLACK_ATTACK_PREFIX |
static int |
noSwaps |
static int |
startedSwaps |
static int |
swaps |
static int |
swapsRejectedAlreadyLocked |
static int |
swapsRejectedNowhereToGo |
static int |
swapsRejectedRateLimit |
static int |
swapsRejectedRecognizedID |
Constructor and Description |
---|
LocationManager(RandomSource r,
Node node) |
Modifier and Type | Method and Description |
---|---|
protected void |
announceLocChange()
Tell all connected peers that our location has changed
|
void |
clearOldSwapChains() |
static double[] |
extractLocs(PeerNode[] peers,
boolean indicateBackoff) |
static long[] |
extractUIDs(PeerNode[] peers) |
int |
getAverageSwapTime() |
java.lang.Object[] |
getKnownLocations(long timestamp)
Method called by Node.getKnownLocations(long timestamp)
|
double |
getLocation() |
double |
getLocChangeSession() |
int |
getNetworkSizeEstimate(long timestamp) |
long |
getSendSwapInterval() |
boolean |
handleSwapCommit(Message m,
PeerNode source)
Handle an unmatched FNPSwapCommit
|
boolean |
handleSwapComplete(Message m,
PeerNode source)
Handle an unmatched FNPSwapComplete
|
boolean |
handleSwapRejected(Message m,
PeerNode source)
Handle an unmatched FNPSwapRejected
|
boolean |
handleSwapReply(Message m,
PeerNode source)
Handle an unmatched FNPSwapReply
|
boolean |
handleSwapRequest(Message m,
PeerNode pn)
Handle an incoming SwapRequest
|
void |
lostOrRestartedNode(PeerNode pn)
We lost the connection to a node, or it was restarted.
|
void |
receivedBytes(int x) |
void |
sentBytes(int x)
Sent some bytes.
|
void |
sentPayload(int x)
Sent payload - only include the number of bytes of actual payload i.e.
|
void |
setLocation(double l) |
void |
start()
Start a thread to send FNPSwapRequests every second when
we are not locked.
|
boolean |
swappingDisabled()
Should we swap? LOCKING: Call without holding locks.
|
void |
updateLocationChangeSession(double newLoc) |
public static final java.lang.String FOIL_PITCH_BLACK_ATTACK_PREFIX
public static int swaps
public static int noSwaps
public static int startedSwaps
public static int swapsRejectedAlreadyLocked
public static int swapsRejectedNowhereToGo
public static int swapsRejectedRateLimit
public static int swapsRejectedRecognizedID
public LocationManager(RandomSource r, Node node)
public double getLocation()
public void setLocation(double l)
l
- public void updateLocationChangeSession(double newLoc)
public void start()
public boolean swappingDisabled()
public long getSendSwapInterval()
protected void announceLocChange()
public boolean handleSwapRequest(Message m, PeerNode pn)
public boolean handleSwapReply(Message m, PeerNode source)
public boolean handleSwapRejected(Message m, PeerNode source)
public boolean handleSwapCommit(Message m, PeerNode source)
public boolean handleSwapComplete(Message m, PeerNode source)
public void clearOldSwapChains()
public void lostOrRestartedNode(PeerNode pn)
public int getNetworkSizeEstimate(long timestamp)
public java.lang.Object[] getKnownLocations(long timestamp)
public static double[] extractLocs(PeerNode[] peers, boolean indicateBackoff)
public static long[] extractUIDs(PeerNode[] peers)
public double getLocChangeSession()
public int getAverageSwapTime()
public void receivedBytes(int x)
receivedBytes
in interface ByteCounter
public void sentBytes(int x)
ByteCounter
sentBytes
in interface ByteCounter
public void sentPayload(int x)
ByteCounter
sentPayload
in interface ByteCounter
x
- Number of bytes sent