java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.FloodSearchJob
net.i2p.router.networkdb.kademlia.FloodOnlySearchJob
- All Implemented Interfaces:
Job
- Direct Known Subclasses:
DirectLookupJob, SingleSearchJob
Flood-only search implementation for network database lookups.
Sends search queries to floodfill peers with no fallback to Kademlia search. Fails completely if no successful match is received from initial peers. Includes enhancements to help routers bootstrap back into the network after losing floodfill references by following floodfill keys in DatabaseSearchReplyMessages.
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReplyJobJob to run on reply.protected final JobJob to run on timeout.private OutNetMessageThis is a marker to register with the MessageRegistry, it is never sent.protected final MessageSelectorReply message selector.private booleanWhether a search reply should be processed.Peers that did not answer this search.Fields inherited from class FloodSearchJob
_created, _dead, _expiration, _facade, _isLease, _key, _log, _lookupsRemaining, _onFailed, _onFind, _success, _timeoutMs, CONCURRENT_SEARCHESModifier and TypeFieldDescriptionprotected final longSystem time when this search was created.protected booleanWhether this search has been marked as completed.protected longDeadline after which the search expires.protected final FloodfillNetworkDatabaseFacadeFloodfill network database facade.protected final booleanWhether the target is a LeaseSet lookup.protected final HashTarget database entry hash being searched.protected final LogClass logger.protected final AtomicIntegerRemaining flood lookups before fallback to iterative search.Callbacks for search failure.Callbacks for successful search completion.protected booleanWhether the search completed successfully.protected intTimeout for the search in milliseconds.protected static final intMax simultaneous flood lookups before fallback.Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFloodOnlySearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs) For DirectLookupJob extension, RI only, different match job.FloodOnlySearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease) Flood-only search for the given key against the floodfill network database.Method Summary
Public MethodsModifier and TypeMethodDescription(package private) intdecrementRemaining(Hash peer) Note that we heard from the peer.(package private) voidfailed()Deprecated, unused, see FOSJ override.getName()Deprecated, unused, see FOSJ override.voidrunJob()Deprecated, unused, see FOSJ override.booleanWhether a DSRM reply should be processed.(package private) voidsuccess()Deprecated, unused, see FOSJ override.Methods inherited from class FloodSearchJob
addDeferred, decrementRemaining, getCreated, getExpiration, getKey, getLookupsRemainingModifier and TypeMethodDescription(package private) voidaddDeferred(Job onFind, Job onFailed, long timeoutMs, boolean isLease) Add jobs to an existing search.protected intNumber of lookups remaining after decrementing.longSystem time, NOT context time.longExpiration time from the context clock.getKey()The database entry hash being searched.protected intNumber of flood lookups still pending.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_shouldProcessDSRM
private boolean _shouldProcessDSRMWhether a search reply should be processed._unheardFrom
_out
This is a marker to register with the MessageRegistry, it is never sent._replySelector
Reply message selector._onReply
Job to run on reply._onTimeout
Job to run on timeout.
Constructor Details
FloodOnlySearchJob
public FloodOnlySearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease) Flood-only search for the given key against the floodfill network database.- Parameters:
ctx- the router contextfacade- the floodfill network database facadekey- the hash key to search foronFind- job to run on successful findonFailed- job to run on failuretimeoutMs- the timeout in millisecondsisLease- true if searching for a lease set
FloodOnlySearchJob
protected FloodOnlySearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs) For DirectLookupJob extension, RI only, different match job.- Parameters:
ctx- the router contextfacade- the floodfill network database facadekey- the hash key to search foronFind- job to run on successful findonFailed- job to run on failuretimeoutMs- the timeout in milliseconds
Method Details
shouldProcessDSRM
public boolean shouldProcessDSRM()Whether a DSRM reply should be processed.- Returns:
- true if DSRM should be processed
runJob
public void runJob()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Specified by:
runJobin interfaceJob- Overrides:
runJobin classFloodSearchJob
getName
Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Specified by:
getNamein interfaceJob- Overrides:
getNamein classFloodSearchJob- Returns:
- the fixed descriptive name
"NetDb Search (phase 1)"of this job
decrementRemaining
Note that we heard from the peer.- Parameters:
peer- the peer hash- Returns:
- number remaining after decrementing
failed
void failed()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Overrides:
failedin classFloodSearchJob
success
void success()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Overrides:
successin classFloodSearchJob