net.i2p.router.networkdb.kademlia

## Class FloodfillDatabaseLookupMessageHandler

- java.lang.Object
- - net.i2p.router.networkdb.kademlia.FloodfillDatabaseLookupMessageHandler

- All Implemented Interfaces:
    HandlerJobBuilder

      public class FloodfillDatabaseLookupMessageHandler
      extends Object
      implements HandlerJobBuilder

  Handler for DatabaseLookupMessage received on floodfills.

  This class verifies incoming lookup messages, applies throttling and banning policies, and builds appropriate jobs for accepted lookups. Unacceptable lookups are logged and dropped.

  It tracks lookup statistics such as received, dropped, handled, and matched lookups via the statManager.

  Supports floodfill and non-floodfill router modes, with special handling for floodfill peers and exploratory lookups.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FloodfillDatabaseLookupMessageHandler(RouterContext context, FloodfillNetworkDatabaseFacade facade)` Constructs a new handler for floodfill DatabaseLookupMessages.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Job` | `createJob(I2NPMessage receivedMessage, RouterIdentity from, Hash fromHash)` Creates a job to handle an incoming DatabaseLookupMessage, or returns null if the lookup should be dropped.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FloodfillDatabaseLookupMessageHandler

          public FloodfillDatabaseLookupMessageHandler(RouterContext context,
                                                       FloodfillNetworkDatabaseFacade facade)

      Constructs a new handler for floodfill DatabaseLookupMessages.
      Parameters:
        `context` - the router context providing system state and utilities
        `facade` - the network database facade used for lookup management and throttling

  - ### Method Detail

    - #### createJob

          public Job createJob(I2NPMessage receivedMessage,
                               RouterIdentity from,
                               Hash fromHash)

      Creates a job to handle an incoming DatabaseLookupMessage, or returns null if the lookup should be dropped.

      This method performs several checks, including: floodfill participation, sender identity, whether the lookup is for this router, throttling, banning, and lookup type compatibility. Logs details about accepted or dropped lookups and updates statistics.

      Specified by:
        `createJob` in interface `HandlerJobBuilder`
      Parameters:
        `receivedMessage` - the incoming message, expected to be a DatabaseLookupMessage
        `from` - the identity of the sender router
        `fromHash` - the hash of the sender router
      Returns:
        a Job to handle the lookup if accepted, or null if dropped
      Throws:
        `ClassCastException` - if receivedMessage is not a DatabaseLookupMessage