|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.peermanager.ProfileOrganizer
public class ProfileOrganizer
Keep the peer profiles organized according to the tiered model. This does not actively update anything - the reorganize() method should be called periodically to recalculate thresholds and move profiles into the appropriate tiers, and addProfile() should be used to add new profiles (placing them into the appropriate groupings).
Field Summary | |
---|---|
static int |
DEFAULT_MINIMUM_FAST_PEERS
|
static int |
DEFAULT_MINIMUM_HIGH_CAPACITY_PEERS
|
static java.lang.String |
PROP_MINIMUM_FAST_PEERS
Defines the minimum number of 'fast' peers that the organizer should select. |
static java.lang.String |
PROP_MINIMUM_HIGH_CAPACITY_PEERS
Defines the minimum number of 'high capacity' peers that the organizer should select when using the mean - if less than this many are available, select the capacity by the median. |
Constructor Summary | |
---|---|
ProfileOrganizer(RouterContext context)
|
Method Summary | |
---|---|
PeerProfile |
addProfile(PeerProfile profile)
Add the new profile, returning the old value (or null if no profile existed) |
int |
countActivePeers()
|
int |
countFailingPeers()
|
int |
countFastPeers()
|
int |
countHighCapacityPeers()
|
int |
countNotFailingPeers()
|
int |
countWellIntegratedPeers()
|
void |
exportProfile(Hash profile,
java.io.OutputStream out)
|
double |
getCapacityThreshold()
|
double |
getIntegrationThreshold()
|
protected int |
getMinimumFastPeers()
Defines the minimum number of 'fast' peers that the organizer should select. |
protected int |
getMinimumHighCapacityPeers()
Defines the minimum number of 'fast' peers that the organizer should select. |
PeerProfile |
getProfile(Hash peer)
Retrieve the profile for the given peer, if one exists (else null) |
double |
getSpeedThreshold()
|
(package private) Hash |
getUs()
|
boolean |
isFailing(Hash peer)
|
boolean |
isFast(Hash peer)
|
boolean |
isHighCapacity(Hash peer)
|
boolean |
isSelectable(Hash peer)
|
boolean |
isWellIntegrated(Hash peer)
|
static void |
main(java.lang.String[] args)
Read in all of the profiles specified and print out their calculated values. |
boolean |
peerSendsBadReplies(Hash peer)
Does the given peer send us bad replies - either invalid store messages (expired, corrupt, etc) or unreachable replies (pointing towards routers that don't exist). |
void |
renderStatusHTML(java.io.Writer out)
|
void |
reorganize()
Place peers into the correct tier, as well as expand/contract and even drop profiles according to whatever limits are in place. |
void |
reorganize(boolean shouldCoalesce)
|
java.util.Set |
selectAllPeers()
Find the hashes for all peers we are actively profiling |
void |
selectFailingPeers(int howMany,
java.util.Set exclude,
java.util.Set matches)
I'm not quite sure why you'd want this... |
void |
selectFastPeers(int howMany,
java.util.Set exclude,
java.util.Set matches)
Return a set of Hashes for peers that are both fast and reliable. |
void |
selectHighCapacityPeers(int howMany,
java.util.Set exclude,
java.util.Set matches)
Return a set of Hashes for peers that have a high capacity |
void |
selectNotFailingPeers(int howMany,
java.util.Set exclude,
java.util.Set matches)
Return a set of Hashes for peers that are not failing, preferring ones that we are already talking with |
void |
selectNotFailingPeers(int howMany,
java.util.Set exclude,
java.util.Set matches,
boolean onlyNotFailing)
Return a set of Hashes for peers that are not failing, preferring ones that we are already talking with |
void |
selectWellIntegratedPeers(int howMany,
java.util.Set exclude,
java.util.Set matches)
Return a set of Hashes for peers that are well integrated into the network. |
void |
setUs(Hash us)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROP_MINIMUM_FAST_PEERS
getMinimumFastPeers()
public static final int DEFAULT_MINIMUM_FAST_PEERS
public static final java.lang.String PROP_MINIMUM_HIGH_CAPACITY_PEERS
public static final int DEFAULT_MINIMUM_HIGH_CAPACITY_PEERS
Constructor Detail |
---|
public ProfileOrganizer(RouterContext context)
Method Detail |
---|
public void setUs(Hash us)
Hash getUs()
public double getSpeedThreshold()
public double getCapacityThreshold()
public double getIntegrationThreshold()
public PeerProfile getProfile(Hash peer)
public PeerProfile addProfile(PeerProfile profile) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public int countFastPeers()
public int countHighCapacityPeers()
public int countWellIntegratedPeers()
public int countNotFailingPeers()
public int countFailingPeers()
public int countActivePeers()
public boolean isFast(Hash peer)
public boolean isHighCapacity(Hash peer)
public boolean isWellIntegrated(Hash peer)
public boolean isFailing(Hash peer)
public boolean peerSendsBadReplies(Hash peer)
public void exportProfile(Hash profile, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void renderStatusHTML(java.io.Writer out) throws java.io.IOException
java.io.IOException
public void selectFastPeers(int howMany, java.util.Set exclude, java.util.Set matches)
howMany
- how many peers are desiredexclude
- set of Hashes for routers that we don't want selectedmatches
- set to store the return value inpublic void selectHighCapacityPeers(int howMany, java.util.Set exclude, java.util.Set matches)
public void selectWellIntegratedPeers(int howMany, java.util.Set exclude, java.util.Set matches)
public void selectNotFailingPeers(int howMany, java.util.Set exclude, java.util.Set matches)
public void selectNotFailingPeers(int howMany, java.util.Set exclude, java.util.Set matches, boolean onlyNotFailing)
howMany
- how many peers to findexclude
- what peers to skip (may be null)matches
- set to store the matches inonlyNotFailing
- if true, don't include any high capacity peerspublic void selectFailingPeers(int howMany, java.util.Set exclude, java.util.Set matches)
public java.util.Set selectAllPeers()
public void reorganize()
public void reorganize(boolean shouldCoalesce)
public boolean isSelectable(Hash peer)
protected int getMinimumFastPeers()
protected int getMinimumHighCapacityPeers()
public static void main(java.lang.String[] args)
ProfileOrganizer [filename]*
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |