java.lang.Object
net.i2p.router.networkdb.kademlia.FloodOnlyLookupSelector
All Implemented Interfaces:
MessageSelector

class FloodOnlyLookupSelectorextends Object implements MessageSelector
Message selector for flood-only database lookup operations.

Matches incoming DatabaseStoreMessage and DatabaseSearchReplyMessage responses to specific flood-only search jobs. Handles response validation, lookup decrement tracking, and coordinates followup searches through SingleLookupJob when appropriate.

Largely superseded by IterativeLookupSelector but retained for compatibility with existing flood-only search implementations. Provides specialized logic for flood-based search response handling with profile management and search lifecycle coordination.

  • Field Details

    • _context

      private final RouterContext _context
      The router running the lookup.
    • _matchFound

      private boolean _matchFound
      True once a peer holding the key answered.
    • _log

      private final Log _log
      Logger for this class.
  • Constructor Details

    • FloodOnlyLookupSelector

      public FloodOnlyLookupSelector(RouterContext ctx, FloodOnlySearchJob search)
      Binds the selector to the search whose replies it matches.
      Parameters:
      ctx - the router context whose netDb and job queue the search drives
      search - the flood-only search whose replies this selector matches
  • Method Details

    • continueMatching

      public boolean continueMatching()
      Continue matching while lookups remain and the match is not yet found.
      Specified by:
      continueMatching in interface MessageSelector
      Returns:
      true to keep searching for further matches, false to stop searching
    • getExpiration

      public long getExpiration()
      Absolute time when the search expires, or -1 once a match is found.
      Specified by:
      getExpiration in interface MessageSelector
      Returns:
      the number of milliseconds since the context clock's epoch at which the search expires, or -1 once a match has been found
    • isMatch

      public boolean isMatch(I2NPMessage message)
      Whether the message is a store for the searched key.
      Specified by:
      isMatch in interface MessageSelector
      Parameters:
      message - the received message to test against this selector
      Returns:
      true if the message carries the key being searched for; the match is recorded and the remaining lookup count is decremented
    • toString

      public String toString()
      Returns a string representation of this selector.
      Overrides:
      toString in class Object