public class PeerProfile extends Object
| Modifier and Type | Field and Description |
|---|---|
(package private) static boolean |
ENABLE_TUNNEL_TEST_RESPONSE_TIME |
| Constructor and Description |
|---|
PeerProfile(RouterContext context,
Hash peer)
Caller should call setLastHeardAbout() and setFirstHeardAbout()
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
coalesceOnly(boolean shouldDecay)
Caller must next call updateValues()
|
void |
coalesceStats()
Coalesce all stats and update values
|
(package private) void |
dataPushed(int size) |
(package private) void |
dataPushed1m(int size)
the tunnel pushed that much data in a 1 minute period
|
boolean |
equals(Object obj) |
void |
expandDBProfile()
For floodfills
|
void |
expandProfile()
When the given peer is performing well enough that we want to keep detailed
stats on them again, call this to set up the info we dropped during shrinkProfile.
|
int |
getCapacityBonus()
extra factor added to the capacity ranking - this can be updated in the profile
written to disk to affect how the algorithm ranks capacity.
|
float |
getCapacityValue()
How many tunnels do we think this peer can handle over the next hour?
|
(package private) RouterContext |
getContext()
Helper for calculators
|
DBHistory |
getDBHistory()
history of db activity with the peer
Warning - may return null if !getIsExpandedDB()
|
RateStat |
getDbIntroduction()
how many new peers we get from dbSearchReplyMessages or dbStore messages, calculated over a 1 hour, 1 day, and 1 week period
Warning - may return null if !getIsExpandedDB()
|
RateStat |
getDbResponseTime()
how long it takes to get a db response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period
Warning - may return null if !getIsExpandedDB()
|
long |
getFirstHeardAbout()
When did we first hear about this peer?
|
int |
getIntegrationBonus()
extra factor added to the integration ranking - this can be updated in the profile
written to disk to affect how the algorithm ranks integration.
|
float |
getIntegrationValue()
How well integrated into the network is this peer (as measured by how much they've
told us that we didn't already know).
|
boolean |
getIsActive()
Is this peer active at the moment (sending/receiving messages within the last
10 minutes)
|
boolean |
getIsActive(long now)
Is this peer active at the moment (sending/receiving messages within the last 10 minutes)
|
boolean |
getIsActive(long period,
long now)
Is this peer active at the moment (sending/receiving messages within the
given period?)
Also mark active if it is connected, as this will tend to encourage use
of already-connected peers.
|
boolean |
getIsExpanded()
are we keeping an expanded profile on the peer, or just the bare minimum.
|
boolean |
getIsExpandedDB() |
long |
getLastHeardAbout()
when did we last hear about this peer?
|
long |
getLastHeardFrom()
when did we last hear from the peer?
|
long |
getLastSendFailed()
when did we last have a problem sending to this peer?
|
long |
getLastSendSuccessful()
when did we last send to this peer successfully?
|
float |
getPeakThroughputKBps() |
float |
getPeakTunnel1mThroughputKBps()
This is the speed value
|
float |
getPeakTunnelThroughputKBps() |
Hash |
getPeer()
what peer is being profiled, non-null
|
RateStat |
getPeerTestResponseTime()
how long it takes for a peer to respond to a direct test (ms)
|
float |
getPeerTestTimeAverage() |
int |
getSpeedBonus()
extra factor added to the speed ranking - this can be updated in the profile
written to disk to affect how the algorithm ranks speed.
|
float |
getSpeedValue()
How fast is the peer, taking into consideration both throughput and latency.
|
RateStat |
getTunnelCreateResponseTime()
how long it takes to get a tunnel create response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period
Warning - may return null if !getIsExpanded()
|
TunnelHistory |
getTunnelHistory()
history of tunnel activity with the peer
Warning - may return null if !getIsExpanded()
|
(package private) int |
getXORDistance()
For now, just a one-byte comparison
|
int |
hashCode() |
(package private) boolean |
isEstablished() |
(package private) boolean |
isSameCountry() |
void |
setCapacityBonus(int bonus) |
void |
setDBHistory(DBHistory hist) |
(package private) void |
setFirstHeardAbout(long when)
Set when did we first heard about this peer, only if older.
|
void |
setIntegrationBonus(int bonus) |
void |
setLastHeardAbout(long when)
Set when did we last hear about this peer, only if unset or newer
Also sets FirstHeardAbout if earlier
|
void |
setLastHeardFrom(long when) |
void |
setLastSendFailed(long when) |
void |
setLastSendSuccessful(long when) |
(package private) void |
setPeakThroughputKBps(float kBps)
Only for restoration from persisted profile.
|
(package private) void |
setPeakTunnel1mThroughputKBps(float kBps)
Only for restoration from persisted profile.
|
(package private) void |
setPeakTunnelThroughputKBps(float kBps)
Only for restoration from persisted profile.
|
(package private) void |
setPeerTestTimeAverage(float testAvg) |
void |
setSpeedBonus(int bonus) |
void |
setTunnelHistory(TunnelHistory history) |
String |
toString() |
(package private) void |
tunnelDataTransferred(long tunnelByteLifetime)
the tunnel pushed that much data in its lifetime
|
(package private) void |
updatePeerTestTimeAverage(float ms) |
void |
updateValues() |
boolean |
wasUnreachable() |
static final boolean ENABLE_TUNNEL_TEST_RESPONSE_TIME
public PeerProfile(RouterContext context, Hash peer)
peer - non-nullvoid coalesceOnly(boolean shouldDecay)
public void coalesceStats()
void dataPushed(int size)
void dataPushed1m(int size)
public void expandDBProfile()
public void expandProfile()
public int getCapacityBonus()
public float getCapacityValue()
RouterContext getContext()
public DBHistory getDBHistory()
public RateStat getDbIntroduction()
public RateStat getDbResponseTime()
public long getFirstHeardAbout()
public int getIntegrationBonus()
public float getIntegrationValue()
public boolean getIsActive()
public boolean getIsActive(long now)
public boolean getIsActive(long period,
long now)
period - must be one of the periods in the RateStat constructors below
(5*60*1000 or 60*60*1000)public boolean getIsExpanded()
public boolean getIsExpandedDB()
public long getLastHeardAbout()
public long getLastHeardFrom()
public long getLastSendFailed()
public long getLastSendSuccessful()
public float getPeakThroughputKBps()
public float getPeakTunnel1mThroughputKBps()
public float getPeakTunnelThroughputKBps()
public Hash getPeer()
public RateStat getPeerTestResponseTime()
public float getPeerTestTimeAverage()
public int getSpeedBonus()
public float getSpeedValue()
public RateStat getTunnelCreateResponseTime()
public TunnelHistory getTunnelHistory()
int getXORDistance()
boolean isEstablished()
boolean isSameCountry()
public void setCapacityBonus(int bonus)
public void setDBHistory(DBHistory hist)
void setFirstHeardAbout(long when)
public void setIntegrationBonus(int bonus)
public void setLastHeardAbout(long when)
public void setLastHeardFrom(long when)
public void setLastSendFailed(long when)
public void setLastSendSuccessful(long when)
void setPeakThroughputKBps(float kBps)
void setPeakTunnel1mThroughputKBps(float kBps)
void setPeakTunnelThroughputKBps(float kBps)
void setPeerTestTimeAverage(float testAvg)
public void setSpeedBonus(int bonus)
public void setTunnelHistory(TunnelHistory history)
void tunnelDataTransferred(long tunnelByteLifetime)
void updatePeerTestTimeAverage(float ms)
public void updateValues()
public boolean wasUnreachable()