public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacade
Modifier and Type | Field and Description |
---|---|
static char |
CAPABILITY_FLOODFILL |
static int |
MAX_TO_FLOOD
This is the flood redundancy.
|
protected static 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.
|
(package private) static 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.
|
_context, _log, _networkID, _peerSelector, DEFAULT_DB_DIR, DONT_FAIL_PERIOD, MAX_EXPLORE_QUEUE, MAX_LEASE_FUTURE, MIN_REMAINING_ROUTERS, MIN_RESEED, PROP_DB_DIR, PUBLISH_JOB_DELAY
Constructor and Description |
---|
FloodfillNetworkDatabaseFacade(RouterContext context) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
complete(Hash key)
Must be called by the search job queued by search() on success or failure
|
protected void |
createHandlers()
unused, see override
|
protected PeerSelector |
createPeerSelector() |
void |
flood(DatabaseEntry ds)
Send to a subset of all floodfill peers.
|
boolean |
floodfillEnabled()
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 boolean |
isFloodfill(RouterInfo peer) |
(package private) boolean |
isVerifyInProgress(Hash h) |
protected 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.
|
void |
publish(RouterInfo localRouterInfo)
Send our RI to the closest floodfill.
|
(package private) SearchJob |
search(Hash key,
Job onFindJob,
Job onFailedLookupJob,
long timeoutMs,
boolean isLease)
Lookup using exploratory tunnels.
|
(package private) SearchJob |
search(Hash key,
Job onFindJob,
Job onFailedLookupJob,
long timeoutMs,
boolean isLease,
Hash fromLocalDest)
Lookup using the client's tunnels.
|
void |
sendStore(Hash key,
DatabaseEntry ds,
Job onSuccess,
Job onFailure,
long sendTimeout,
Set<Hash> toIgnore)
unused (overridden in FNDF)
|
void |
setFloodfillEnabled(boolean yes) |
(package private) boolean |
shouldThrottleFlood(Hash key)
Increments and tests.
|
(package private) boolean |
shouldThrottleLookup(Hash from,
TunnelId id)
Increments and tests.
|
void |
shutdown()
If we are floodfill, turn it off and tell everybody.
|
void |
startup()
Instruct the service that it should start normal operation.
|
(package private) void |
verifyFinished(Hash h) |
(package private) void |
verifyStarted(Hash h) |
dropAfterLookupFailed, fail, failPermanently, findNearestRouters, getAllRouters, getDataStore, getDbDir, getExploreKeys, getKBuckets, getKBucketSetSize, getKnownLeaseSets, getKnownRouters, getLastExploreNewDate, getLastRouterInfoPublishTime, getLeases, getPeerSelector, getPeerTimeout, getRouters, isInitialized, isNegativeCached, isNegativeCachedForever, lookupDestination, lookupDestinationLocally, lookupFailed, lookupLeaseSet, lookupLeaseSet, lookupLeaseSetLocally, lookupLeaseSetRemotely, lookupLocally, lookupLocallyWithoutValidation, lookupRouterInfo, lookupRouterInfoLocally, publish, queueForExploration, removeFromExploreKeys, renderStatusHTML, rescan, reseedChecker, restart, routerInfoPublishSuccessful, searchComplete, setLastExploreNewDate, stopPublishing, store, store, store, unpublish, validate
store
public static final char CAPABILITY_FLOODFILL
public static final int MAX_TO_FLOOD
static final long PUBLISH_TIMEOUT
protected static final int MIN_ACTIVE_PEERS
public FloodfillNetworkDatabaseFacade(RouterContext context)
public void startup()
Service
startup
in interface Service
startup
in class KademliaNetworkDatabaseFacade
protected void createHandlers()
KademliaNetworkDatabaseFacade
createHandlers
in class KademliaNetworkDatabaseFacade
public void shutdown()
shutdown
in interface Service
shutdown
in class KademliaNetworkDatabaseFacade
public void publish(RouterInfo localRouterInfo) throws IllegalArgumentException
publish
in class KademliaNetworkDatabaseFacade
IllegalArgumentException
- if the local router info is invalidpublic void sendStore(Hash key, DatabaseEntry ds, Job onSuccess, Job onFailure, long sendTimeout, Set<Hash> toIgnore)
KademliaNetworkDatabaseFacade
sendStore
in class KademliaNetworkDatabaseFacade
boolean shouldThrottleFlood(Hash key)
boolean shouldThrottleLookup(Hash from, TunnelId id)
public void flood(DatabaseEntry ds)
protected PeerSelector createPeerSelector()
createPeerSelector
in class KademliaNetworkDatabaseFacade
public void setFloodfillEnabled(boolean yes)
public boolean floodfillEnabled()
NetworkDatabaseFacade
floodfillEnabled
in class NetworkDatabaseFacade
public static boolean isFloodfill(RouterInfo peer)
peer
- may be null, returns false if nullpublic List<RouterInfo> getKnownRouterData()
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease)
search
in class KademliaNetworkDatabaseFacade
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease, Hash fromLocalDest)
search
in class KademliaNetworkDatabaseFacade
fromLocalDest
- use these tunnels for the lookup, or null for exploratoryvoid complete(Hash key)
public List<Hash> getFloodfillPeers()
boolean isVerifyInProgress(Hash h)
void verifyStarted(Hash h)
void verifyFinished(Hash h)
protected void lookupBeforeDropping(Hash peer, RouterInfo info)
lookupBeforeDropping
in class KademliaNetworkDatabaseFacade