Class FloodfillNetworkDatabaseFacade
- java.lang.Object
- 
- net.i2p.router.NetworkDatabaseFacade
- 
- net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacade
- 
- net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade
 
 
 
- 
- All Implemented Interfaces:
- Service
 
 public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacade The network database
- 
- 
Field SummaryFields Modifier and Type Field Description static charCAPABILITY_FLOODFILLstatic intMAX_TO_FLOODThis is the flood redundancy.protected static intMIN_ACTIVE_PEERSNTCP cons drop quickly but SSU takes a while, so it's prudent to keep this a little higher than 1 or 2.(package private) static longPUBLISH_TIMEOUTThis maybe could be shorter than RepublishLeaseSetJob.REPUBLISH_LEASESET_TIMEOUT, because we are sending direct, but unresponsive floodfills may take a while due to timeouts.- 
Fields inherited from class net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacade_context, _log, _networkID, _peerSelector, DEFAULT_DB_DIR, DONT_FAIL_PERIOD, MAX_EXPLORE_QUEUE, MIN_REMAINING_ROUTERS, MIN_RESEED, PROP_DB_DIR, PUBLISH_JOB_DELAY
 
- 
 - 
Constructor SummaryConstructors Constructor Description FloodfillNetworkDatabaseFacade(RouterContext context)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcomplete(Hash key)Must be called by the search job queued by search() on success or failureprotected voidcreateHandlers()unused, see overrideprotected PeerSelectorcreatePeerSelector()voidflood(DatabaseEntry ds)Send to a subset of all floodfill peers.booleanfloodConditional(DatabaseEntry ds)If we are floodfill AND the key is not throttled, flood it, otherwise don't.booleanfloodfillEnabled()For convenience, so users don't have to cast to FNDF, and unit tests using Dummy NDF will work.List<Hash>getFloodfillPeers()list of the Hashes of currently known floodfill peers; Returned list will not include our own hash.List<RouterInfo>getKnownRouterData()static booleanisFloodfill(RouterInfo peer)(package private) booleanisVerifyInProgress(Hash h)protected voidlookupBeforeDropping(Hash peer, RouterInfo info)Search for a newer router info, drop it from the db if the search fails, unless just started up or have bigger problems.voidpublish(RouterInfo localRouterInfo)Send our RI to the closest floodfill.(package private) SearchJobsearch(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease)Lookup using exploratory tunnels.(package private) SearchJobsearch(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease, Hash fromLocalDest)Lookup using the client's tunnels.voidsendStore(Hash key, DatabaseEntry ds, Job onSuccess, Job onFailure, long sendTimeout, Set<Hash> toIgnore)unused (overridden in FNDF)voidsetFloodfillEnabled(boolean yes)Public, called from console.(package private) voidsetFloodfillEnabledFromMonitor(boolean yes)Package private, called from FloodfillMonitorJob.(package private) booleanshouldThrottleFlood(Hash key)Increments and tests.(package private) booleanshouldThrottleLookup(Hash from, TunnelId id)Increments and tests.voidshutdown()If we are floodfill, turn it off and tell everybody.voidstartup()Instruct the service that it should start normal operation.(package private) voidverifyFinished(Hash h)(package private) voidverifyStarted(Hash h)- 
Methods inherited from class net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacadedropAfterLookupFailed, fail, failPermanently, findNearestRouters, getAllRouters, getBlindData, getBlindData, getDataStore, getDbDir, getExploreKeys, getKBuckets, getKBucketSetSize, getKnownLeaseSets, getKnownRouters, getLastExploreNewDate, getLastRouterInfoPublishTime, getLeases, getPeerSelector, getPeerTimeout, getRouters, isInitialized, isNegativeCached, isNegativeCachedForever, lookupDestination, lookupDestinationLocally, lookupFailed, lookupLeaseSet, lookupLeaseSet, lookupLeaseSetLocally, lookupLeaseSetRemotely, lookupLeaseSetRemotely, lookupLocally, lookupLocallyWithoutValidation, lookupRouterInfo, lookupRouterInfoLocally, publish, queueForExploration, removeBlindData, removeFromExploreKeys, renderStatusHTML, rescan, reseedChecker, restart, routerInfoPublishSuccessful, routingKeyChanged, searchComplete, setBlindData, setLastExploreNewDate, stopPublishing, store, store, store, unpublish, validate
 - 
Methods inherited from class net.i2p.router.NetworkDatabaseFacadestore
 
- 
 
- 
- 
- 
Field Detail- 
CAPABILITY_FLOODFILLpublic static final char CAPABILITY_FLOODFILL - See Also:
- Constant Field Values
 
 - 
MAX_TO_FLOODpublic static final int MAX_TO_FLOOD This is the flood redundancy. Entries are sent to this many other floodfills. Was 7 through release 0.9; 5 for 0.9.1. 4 as of 0.9.2; 3 as of 0.9.9- See Also:
- Constant Field Values
 
 - 
PUBLISH_TIMEOUTstatic final long PUBLISH_TIMEOUT This maybe could be shorter than RepublishLeaseSetJob.REPUBLISH_LEASESET_TIMEOUT, because we are sending direct, but unresponsive floodfills may take a while due to timeouts.- See Also:
- Constant Field Values
 
 - 
MIN_ACTIVE_PEERSprotected static final int MIN_ACTIVE_PEERS NTCP cons drop quickly but SSU takes a while, so it's prudent to keep this a little higher than 1 or 2.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
FloodfillNetworkDatabaseFacadepublic FloodfillNetworkDatabaseFacade(RouterContext context) 
 
- 
 - 
Method Detail- 
startuppublic void startup() Description copied from interface:ServiceInstruct the service that it should start normal operation. This call DOES block until the service is ready.- Specified by:
- startupin interface- Service
- Overrides:
- startupin class- KademliaNetworkDatabaseFacade
 
 - 
createHandlersprotected void createHandlers() Description copied from class:KademliaNetworkDatabaseFacadeunused, see override- Overrides:
- createHandlersin class- KademliaNetworkDatabaseFacade
 
 - 
shutdownpublic void shutdown() If we are floodfill, turn it off and tell everybody.- Specified by:
- shutdownin interface- Service
- Overrides:
- shutdownin class- KademliaNetworkDatabaseFacade
- Since:
- 0.8.9
 
 - 
publishpublic void publish(RouterInfo localRouterInfo) throws IllegalArgumentException Send our RI to the closest floodfill.- Overrides:
- publishin class- KademliaNetworkDatabaseFacade
- Throws:
- IllegalArgumentException- if the local router info is invalid
 
 - 
sendStorepublic void sendStore(Hash key, DatabaseEntry ds, Job onSuccess, Job onFailure, long sendTimeout, Set<Hash> toIgnore) Description copied from class:KademliaNetworkDatabaseFacadeunused (overridden in FNDF)- Specified by:
- sendStorein class- KademliaNetworkDatabaseFacade
 
 - 
shouldThrottleFloodboolean shouldThrottleFlood(Hash key) Increments and tests.- Since:
- 0.7.11
 
 - 
shouldThrottleLookupboolean shouldThrottleLookup(Hash from, TunnelId id) Increments and tests.- Since:
- 0.7.11
 
 - 
floodConditionalpublic boolean floodConditional(DatabaseEntry ds) If we are floodfill AND the key is not throttled, flood it, otherwise don't.- Returns:
- if we did
- Since:
- 0.9.36 for NTCP2
 
 - 
floodpublic void flood(DatabaseEntry ds) Send to a subset of all floodfill peers. We do this to implement Kademlia within the floodfills, i.e. we flood to those closest to the key.
 - 
createPeerSelectorprotected PeerSelector createPeerSelector() - Specified by:
- createPeerSelectorin class- KademliaNetworkDatabaseFacade
 
 - 
setFloodfillEnabledpublic void setFloodfillEnabled(boolean yes) Public, called from console. This wakes up the floodfill monitor, which will rebuild the RI and log in the event log, and call setFloodfillEnabledFromMonitor which really sets it.
 - 
setFloodfillEnabledFromMonitorvoid setFloodfillEnabledFromMonitor(boolean yes) Package private, called from FloodfillMonitorJob. This does not wake up the floodfill monitor.- Since:
- 0.9.34
 
 - 
floodfillEnabledpublic boolean floodfillEnabled() Description copied from class:NetworkDatabaseFacadeFor convenience, so users don't have to cast to FNDF, and unit tests using Dummy NDF will work.- Overrides:
- floodfillEnabledin class- NetworkDatabaseFacade
- Returns:
- false; FNDF overrides to return actual setting
 
 - 
isFloodfillpublic static boolean isFloodfill(RouterInfo peer) - Parameters:
- peer- may be null, returns false if null
 
 - 
getKnownRouterDatapublic List<RouterInfo> getKnownRouterData() 
 - 
searchSearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) Lookup using exploratory tunnels. Caller should check negative cache and/or banlist before calling. Begin a kademlia style search for the key specified, which can take up to timeoutMs and will fire the appropriate jobs on success or timeout (or if the kademlia search completes without any match)- Overrides:
- searchin class- KademliaNetworkDatabaseFacade
- Returns:
- null always
 
 - 
searchSearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease, Hash fromLocalDest) Lookup using the client's tunnels. Caller should check negative cache and/or banlist before calling.- Overrides:
- searchin class- KademliaNetworkDatabaseFacade
- Parameters:
- fromLocalDest- use these tunnels for the lookup, or null for exploratory
- Returns:
- null always
- Since:
- 0.9.10
 
 - 
completevoid complete(Hash key) Must be called by the search job queued by search() on success or failure
 - 
getFloodfillPeerspublic List<Hash> getFloodfillPeers() list of the Hashes of currently known floodfill peers; Returned list will not include our own hash. List is not sorted and not shuffled.
 - 
isVerifyInProgressboolean isVerifyInProgress(Hash h) - Since:
- 0.7.10
 
 - 
verifyStartedvoid verifyStarted(Hash h) - Since:
- 0.7.10
 
 - 
verifyFinishedvoid verifyFinished(Hash h) - Since:
- 0.7.10
 
 - 
lookupBeforeDroppingprotected void lookupBeforeDropping(Hash peer, RouterInfo info) Search for a newer router info, drop it from the db if the search fails, unless just started up or have bigger problems.- Overrides:
- lookupBeforeDroppingin class- KademliaNetworkDatabaseFacade
 
 
- 
 
-