public class DHTSelection
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
DHTSelection.acceptRemoteIndexSeedEnum |
private static class |
DHTSelection.providesRemoteCrawlURLsEnum |
private static class |
DHTSelection.seedDHTEnum |
Constructor and Description |
---|
DHTSelection() |
Modifier and Type | Method and Description |
---|---|
private static java.util.ArrayList<Seed> |
collectHorizontalDHTPositions(SeedDB seedDB,
byte[] wordhash,
int minage,
int redundancy,
int maxredundancy,
java.util.Random random) |
static java.util.Iterator<Seed> |
getAcceptRemoteIndexSeeds(SeedDB seedDB,
byte[] starthash,
int max,
boolean alsoMyOwn)
returns an enumeration of yacySeed-Objects that have the AcceptRemoteIndex-Flag set
the seeds are enumerated in the right order according to the DHT
|
static java.util.List<Seed> |
getAcceptRemoteIndexSeedsList(SeedDB seedDB,
byte[] starthash,
int max,
boolean alsoMyOwn) |
static java.util.Iterator<Seed> |
getProvidesRemoteCrawlURLs(SeedDB seedDB)
enumerate peers that provide remote crawl urls
|
static byte[] |
limitOver(SeedDB seedDB,
byte[] startHash) |
static java.util.concurrent.ConcurrentMap<java.lang.String,Seed> |
seedsByAge(SeedDB seedDB,
boolean up,
int count)
get either the youngest or oldest peers from the seed db.
|
static java.util.Set<Seed> |
selectClusterPeers(SeedDB seedDB,
java.util.SortedSet<byte[]> peerhashes) |
static java.util.List<Seed>[] |
selectDHTDistributionTargets(SeedDB seedDB,
byte[] wordhash,
int minage,
int redundancy) |
static java.util.Set<Seed> |
selectDHTSearchTargets(SeedDB seedDB,
HandleSet wordhashes,
int minage,
int redundancy,
int maxredundancy,
java.util.Random random) |
static java.util.Collection<Seed> |
selectExtraTargets(SeedDB seedDB,
HandleSet wordhashes,
int minage,
java.util.Collection<Seed> omit,
int maxcount,
java.util.Random r) |
static byte[] |
selectRandomTransferStart() |
private static java.util.ArrayList<Seed> |
selectVerticalDHTPositions(SeedDB seedDB,
byte[] wordhash,
int minage,
int redundancy,
int verticalPosition)
collecting vertical positions: that chooses for each of the DHT partition a collection of redundant storage positions
|
public static java.util.Set<Seed> selectClusterPeers(SeedDB seedDB, java.util.SortedSet<byte[]> peerhashes)
public static java.util.Collection<Seed> selectExtraTargets(SeedDB seedDB, HandleSet wordhashes, int minage, java.util.Collection<Seed> omit, int maxcount, java.util.Random r)
seedDB
- wordhashes
- minage
- omit
- maxcount
- r
- we must use a random factor for the selection to prevent that all peers do the same and therefore overload the same peerspublic static java.util.Set<Seed> selectDHTSearchTargets(SeedDB seedDB, HandleSet wordhashes, int minage, int redundancy, int maxredundancy, java.util.Random random)
private static java.util.ArrayList<Seed> collectHorizontalDHTPositions(SeedDB seedDB, byte[] wordhash, int minage, int redundancy, int maxredundancy, java.util.Random random)
public static java.util.List<Seed>[] selectDHTDistributionTargets(SeedDB seedDB, byte[] wordhash, int minage, int redundancy)
private static java.util.ArrayList<Seed> selectVerticalDHTPositions(SeedDB seedDB, byte[] wordhash, int minage, int redundancy, int verticalPosition)
seedDB
- the database of seedswordhash
- the word we are searching forminage
- the minimum age of a seed in days (to prevent that too young seeds which cannot have results yet are asked)redundancy
- the number of redundant peer position for this parition, minimum is 1verticalPosition
- the verical position, thats the number of the partition 0 <= verticalPosition < seedDB.scheme.verticalPartitions()public static byte[] selectRandomTransferStart()
public static byte[] limitOver(SeedDB seedDB, byte[] startHash)
public static java.util.List<Seed> getAcceptRemoteIndexSeedsList(SeedDB seedDB, byte[] starthash, int max, boolean alsoMyOwn)
public static java.util.Iterator<Seed> getAcceptRemoteIndexSeeds(SeedDB seedDB, byte[] starthash, int max, boolean alsoMyOwn)
seedDB
- starthash
- max
- alsoMyOwn
- public static java.util.Iterator<Seed> getProvidesRemoteCrawlURLs(SeedDB seedDB)
seedDB
- public static java.util.concurrent.ConcurrentMap<java.lang.String,Seed> seedsByAge(SeedDB seedDB, boolean up, int count)
seedDB
- up
- if up = true then get the most recent peers, if up = false then get oldestcount
- number of wanted peers