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 |
NEXT_RKEY_RI_ADVANCE_TIME |
static String |
PROP_FLOODFILL_AT_RESTART |
static String |
PROP_FLOODFILL_PARTICIPANT |
(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, MIN_REMAINING_ROUTERS, MIN_RESEED, PROP_DB_DIR, PUBLISH_JOB_DELAY
Constructor and Description |
---|
FloodfillNetworkDatabaseFacade(RouterContext context)
Main DB
|
FloodfillNetworkDatabaseFacade(RouterContext context,
Hash dbid)
Sub DBs
|
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
|
void |
flood(DatabaseEntry ds)
Send to a subset of all floodfill peers.
|
boolean |
floodConditional(DatabaseEntry ds)
If we are floodfill AND the key is not throttled,
flood it, otherwise don't.
|
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.
|
(package private) void |
sendStore(Hash key,
DatabaseEntry ds,
Job onSuccess,
Job onFailure,
long sendTimeout,
Set<Hash> toIgnore)
Send out a store.
|
void |
setFloodfillEnabled(boolean yes)
Public, called from console.
|
(package private) void |
setFloodfillEnabledFromMonitor(boolean yes)
Package private, called from FloodfillMonitorJob.
|
(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) |
blindCache, createPeerSelector, dropAfterLookupFailed, fail, failPermanently, findNearestRouters, getAllRouters, getBlindData, getBlindData, getDataStore, getDbDir, getExploreKeys, getKBuckets, getKBucketSetSize, getKnownLeaseSets, getKnownRouters, getLastExploreNewDate, getLastRouterInfoPublishTime, getLeases, getPeerSelector, getPeerTimeout, getRouters, isClientDb, isInitialized, isNegativeCached, isNegativeCachedForever, isNewer, 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, store, toString, unpublish, validate, validate
store
public static final char CAPABILITY_FLOODFILL
public static final int MAX_TO_FLOOD
static final long NEXT_RKEY_RI_ADVANCE_TIME
public static final String PROP_FLOODFILL_PARTICIPANT
public static final String PROP_FLOODFILL_AT_RESTART
static final long PUBLISH_TIMEOUT
protected static final int MIN_ACTIVE_PEERS
public FloodfillNetworkDatabaseFacade(RouterContext context)
public FloodfillNetworkDatabaseFacade(RouterContext context, Hash dbid)
dbid
- null for main DBpublic 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 invalidvoid sendStore(Hash key, DatabaseEntry ds, Job onSuccess, Job onFailure, long sendTimeout, Set<Hash> toIgnore)
sendStore
in class KademliaNetworkDatabaseFacade
key
- the DatabaseEntry hashonSuccess
- may be null, always called if we are ff and ds is an RIonFailure
- may be null, ignored if we are ff and ds is an RIsendTimeout
- ignored if we are ff and ds is an RItoIgnore
- may be null, if non-null, all attempted and skipped targets will be added as of 0.9.53,
unused if we are ff and ds is an RIboolean shouldThrottleFlood(Hash key)
boolean shouldThrottleLookup(Hash from, TunnelId id)
public boolean floodConditional(DatabaseEntry ds)
public void flood(DatabaseEntry ds)
public void setFloodfillEnabled(boolean yes)
void setFloodfillEnabledFromMonitor(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