net.i2p.router.networkdb.kademlia

## Class FloodfillNetworkDatabaseSegmentor

- java.lang.Object
- - net.i2p.router.networkdb.kademlia.SegmentedNetworkDatabaseFacade
  - - net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseSegmentor

-     public class FloodfillNetworkDatabaseSegmentor
      extends SegmentedNetworkDatabaseFacade

  FloodfillNetworkDatabaseSegmentor Default implementation of the SegmentedNetworkDatabaseFacade. This is a datastructure which manages (3+Clients) "sub-netDbs" on behalf of an I2P router, each representing it's own view of the network. Normally, these sub-netDb's are identified by the hash of the primary session belonging to the client who "owns" a particular sub-netDb. There is one "Special" netDb which has a non-hash name. This is used for the operation of router itself and not clients, in particular when acting as a floodfill: - Main NetDB: This is the netDb we use if or when we become a floodfill, and for direct interaction with other routers on the network, such as when we are communicating with a floodfill. It is possible that it may be advantageous some day to have other netDb's for specific use cases, but that is not the purpose of this class at this time. And there are an unlimited number of "Client" netDbs. These sub-netDbs are intended to contain only the information required to operate them, and as such most of them are very small, containing only a few LeaseSets belonging to clients. Each one corresponds to a Destination which can receive information from the netDb, and can be indexed either by it's hash or by it's base32 address. This index is known as the 'dbid' or database id. Users of this class should strive to always access their sub-netDbs via the explicit DBID of the destination recipient, or using the DBID of the special netDb when it's appropriate to route the netDb entry to one of the special tables.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Hash` | `MAIN_DBID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FloodfillNetworkDatabaseSegmentor(RouterContext context)` Construct a new FloodfillNetworkDatabaseSegmentor with the given RouterContext, containing a default, main netDb and which is prepared to add client netDbs.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `NetworkDatabaseFacade` | `clientNetDB(Hash id)` get the client netDb for the given id Will return the "main" netDb if the dbid is null.
    `NetworkDatabaseFacade` | `mainNetDB()` get the main netDb, which is the one we will use if we are a floodfill
    `void` | `shutdown()` If we are floodfill, turn it off and tell everybody for the _mainDbid
    `void` | `startup()` Start up the _mainDbid

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

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

- - ### Field Detail

    - #### MAIN_DBID

          public static final Hash MAIN_DBID

  - ### Constructor Detail

    - #### FloodfillNetworkDatabaseSegmentor

          public FloodfillNetworkDatabaseSegmentor(RouterContext context)

      Construct a new FloodfillNetworkDatabaseSegmentor with the given RouterContext, containing a default, main netDb and which is prepared to add client netDbs.

  - ### Method Detail

    - #### clientNetDB

          public NetworkDatabaseFacade clientNetDB(Hash id)

      get the client netDb for the given id Will return the "main" netDb if the dbid is null.
      Specified by:
        `clientNetDB` in class `SegmentedNetworkDatabaseFacade`
      Returns:
        non-null, the main netDb if the client netDb does not exist

    - #### mainNetDB

          public NetworkDatabaseFacade mainNetDB()

      get the main netDb, which is the one we will use if we are a floodfill
      Specified by:
        `mainNetDB` in class `SegmentedNetworkDatabaseFacade`
      Returns:
        may be null

    - #### shutdown

          public void shutdown()

      If we are floodfill, turn it off and tell everybody for the _mainDbid
      Specified by:
        `shutdown` in class `SegmentedNetworkDatabaseFacade`

    - #### startup

          public void startup()

      Start up the _mainDbid
      Specified by:
        `startup` in class `SegmentedNetworkDatabaseFacade`