Package com.biglybt.core.dht.router
Interface DHTRouter
- All Known Implementing Classes:
DHTRouterImpl
,DHTRouterWrapper
public interface DHTRouter
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a routing table observer if it is not already observing.void
contactAlive
(byte[] node_id, DHTRouterContactAttachment attachment) Adds a contact to the router and marks it as "known to be alive"contactDead
(byte[] node_id, boolean force) Informs the router that an attempt to interact with the contact failedvoid
contactKnown
(byte[] node_id, DHTRouterContactAttachment attachment, boolean force) Adds a contact to the router.boolean
Returns whether the given observer is already observing.void
destroy()
findBestContacts
(int max) returns a list of best contacts in terms of uptime, best firstfindClosestContacts
(byte[] node_id, int num_to_return, boolean live_only) Returns num_to_return or a few more closest contacts, unorderedfindContact
(byte[] node_id) Returns a list of DHTRouterContact objectsbyte[]
getID()
int
getK()
getStats()
boolean
isID
(byte[] node_id) void
print()
void
recordLookup
(byte[] node_id) void
refreshIdleLeaves
(long idle_max) byte[]
boolean
Removes the observer if it is already observing.boolean
requestPing
(byte[] node_id) void
seed()
Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets)void
setAdapter
(DHTRouterAdapter _adapter) void
setSleeping
(boolean sleeping) void
setSuspended
(boolean susp)
-
Method Details
-
getK
int getK() -
getID
byte[] getID() -
isID
boolean isID(byte[] node_id) -
getLocalContact
DHTRouterContact getLocalContact() -
setAdapter
-
seed
void seed()Tells the router to perform its "start of day" functions required to integrate it into the DHT (search for itself, refresh buckets) -
contactKnown
Adds a contact to the router. The contact is not known to be alive (e.g. we've been returned the contact by someone but we've not either got a reply from it, nor has it invoked us.- Parameters:
node_id
-attachment
-
-
contactAlive
Adds a contact to the router and marks it as "known to be alive"- Parameters:
node_id
-attachment
-
-
contactDead
Informs the router that an attempt to interact with the contact failed- Parameters:
node_id
-attachment
-- Returns:
-
findContact
-
findClosestContacts
Returns num_to_return or a few more closest contacts, unordered -
recordLookup
void recordLookup(byte[] node_id) -
requestPing
boolean requestPing(byte[] node_id) -
refreshIdleLeaves
void refreshIdleLeaves(long idle_max) -
refreshRandom
byte[] refreshRandom() -
findBestContacts
returns a list of best contacts in terms of uptime, best first- Parameters:
max
-- Returns:
-
getAllContacts
List<DHTRouterContact> getAllContacts()Returns a list of DHTRouterContact objects- Returns:
-
getStats
DHTRouterStats getStats() -
setSleeping
void setSleeping(boolean sleeping) -
setSuspended
void setSuspended(boolean susp) -
destroy
void destroy() -
print
void print() -
addObserver
Adds a routing table observer if it is not already observing.- Parameters:
rto
- the observer to add- Returns:
true
if now observing,false
otherwise
-
containsObserver
Returns whether the given observer is already observing.- Parameters:
rto
- the observer to query as observing- Returns:
true
if observing,false
otherwise
-
removeObserver
Removes the observer if it is already observing.- Parameters:
rto
- the observer to remove- Returns:
true
if no longer observing,false
otherwise
-