public class PeerProfile extends Object
Constructor and Description |
---|
PeerProfile(RouterContext context,
Hash peer) |
PeerProfile(RouterContext context,
Hash peer,
boolean expand) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
coalesceOnly()
Caller must next call updateValues()
|
void |
coalesceStats()
update the stats and rates (this should be called once a minute)
|
(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.
|
long |
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.
|
double |
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?
Currently unused, candidate for removal.
|
long |
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.
|
double |
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
5 minutes)
|
boolean |
getIsActive(long period)
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() |
boolean |
getIsFailing()
is this peer actively failing (aka not worth touching)?
deprecated - unused - always false
|
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?
|
double |
getPeakThroughputKBps() |
double |
getPeakTunnel1mThroughputKBps() |
double |
getPeakTunnelThroughputKBps() |
Hash |
getPeer()
what peer is being profiled
|
long |
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.
|
double |
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()
|
RateStat |
getTunnelTestResponseTime()
how long it takes to successfully test a tunnel this peer participates in (in milliseconds), calculated over a 10 minute, 1 hour, and 1 day period
Warning - may return null if !getIsExpanded()
|
double |
getTunnelTestTimeAverage() |
(package private) int |
getXORDistance()
For now, just a one-byte comparison
|
int |
hashCode() |
int |
incrementBanlists() |
(package private) boolean |
isEstablished() |
(package private) boolean |
isSameCountry() |
void |
setCapacityBonus(long bonus) |
void |
setDBHistory(DBHistory hist) |
void |
setFirstHeardAbout(long when) |
void |
setIntegrationBonus(long bonus) |
(package private) void |
setIsFailing(boolean val)
deprecated - unused - always false
|
void |
setLastHeardAbout(long when) |
void |
setLastHeardFrom(long when) |
void |
setLastSendFailed(long when) |
void |
setLastSendSuccessful(long when) |
void |
setPeakThroughputKBps(double kBps) |
void |
setPeakTunnel1mThroughputKBps(double kBps) |
void |
setPeakTunnelThroughputKBps(double kBps) |
void |
setSpeedBonus(long bonus) |
void |
setTunnelHistory(TunnelHistory history) |
(package private) void |
setTunnelTestTimeAverage(double avg) |
String |
toString() |
(package private) void |
tunnelDataTransferred(long tunnelByteLifetime)
the tunnel pushed that much data in its lifetime
|
void |
unbanlist() |
(package private) void |
updateTunnelTestTimeAverage(long ms) |
(package private) void |
updateValues()
Copy over the new values generated by coalesceOnly()
|
(package private) boolean |
wasUnreachable() |
public PeerProfile(RouterContext context, Hash peer)
public PeerProfile(RouterContext context, Hash peer, boolean expand)
expand
- must be true (see below)public Hash getPeer()
public boolean getIsExpanded()
public boolean getIsExpandedDB()
public int incrementBanlists()
public void unbanlist()
public boolean getIsActive()
boolean isEstablished()
boolean wasUnreachable()
boolean isSameCountry()
int getXORDistance()
public boolean getIsActive(long period)
period
- must be one of the periods in the RateStat constructors below
(5*60*1000 or 60*60*1000)public long getFirstHeardAbout()
public void setFirstHeardAbout(long when)
public long getLastHeardAbout()
public void setLastHeardAbout(long when)
public long getLastSendSuccessful()
public void setLastSendSuccessful(long when)
public long getLastSendFailed()
public void setLastSendFailed(long when)
public long getLastHeardFrom()
public void setLastHeardFrom(long when)
public TunnelHistory getTunnelHistory()
public void setTunnelHistory(TunnelHistory history)
public DBHistory getDBHistory()
public void setDBHistory(DBHistory hist)
public RateStat getDbResponseTime()
public RateStat getTunnelCreateResponseTime()
public RateStat getTunnelTestResponseTime()
public RateStat getDbIntroduction()
public long getSpeedBonus()
public void setSpeedBonus(long bonus)
public long getCapacityBonus()
public void setCapacityBonus(long bonus)
public long getIntegrationBonus()
public void setIntegrationBonus(long bonus)
public double getSpeedValue()
public double getCapacityValue()
public double getIntegrationValue()
public boolean getIsFailing()
public double getTunnelTestTimeAverage()
void setTunnelTestTimeAverage(double avg)
void updateTunnelTestTimeAverage(long ms)
public double getPeakThroughputKBps()
public void setPeakThroughputKBps(double kBps)
void dataPushed(int size)
void tunnelDataTransferred(long tunnelByteLifetime)
public double getPeakTunnelThroughputKBps()
public void setPeakTunnelThroughputKBps(double kBps)
void dataPushed1m(int size)
public double getPeakTunnel1mThroughputKBps()
public void setPeakTunnel1mThroughputKBps(double kBps)
public void expandProfile()
public void expandDBProfile()
public void coalesceStats()
void coalesceOnly()
void updateValues()
void setIsFailing(boolean val)
RouterContext getContext()