Class FloodfillNetworkDatabaseSegmentor
java.lang.Object
net.i2p.router.networkdb.kademlia.SegmentedNetworkDatabaseFacade
net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseSegmentor
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 recieve 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.
- Since:
- 0.9.61
- Author:
- idk
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstruct a new FloodfillNetworkDatabaseSegmentor with the given RouterContext, containing a default, main netDb and which is prepared to add client netDbs. -
Method Summary
Modifier and TypeMethodDescriptionclientNetDB
(Hash id) get the client netDb for the given id Will return the "main" netDb if the dbid is null.get the main netDb, which is the one we will use if we are a floodfillvoid
shutdown()
If we are floodfill, turn it off and tell everybody for the _mainDbidvoid
startup()
Start up the _mainDbid
-
Field Details
-
MAIN_DBID
-
-
Constructor Details
-
FloodfillNetworkDatabaseSegmentor
Construct a new FloodfillNetworkDatabaseSegmentor with the given RouterContext, containing a default, main netDb and which is prepared to add client netDbs.- Since:
- 0.9.61
-
-
Method Details
-
shutdown
public void shutdown()If we are floodfill, turn it off and tell everybody for the _mainDbid- Specified by:
shutdown
in classSegmentedNetworkDatabaseFacade
- Since:
- 0.9.61
-
startup
public void startup()Start up the _mainDbid- Specified by:
startup
in classSegmentedNetworkDatabaseFacade
- Since:
- 0.9.61
-
mainNetDB
get the main netDb, which is the one we will use if we are a floodfill- Specified by:
mainNetDB
in classSegmentedNetworkDatabaseFacade
- Returns:
- may be null
- Since:
- 0.9.61
-
clientNetDB
get the client netDb for the given id Will return the "main" netDb if the dbid is null.- Specified by:
clientNetDB
in classSegmentedNetworkDatabaseFacade
- Returns:
- non-null, the main netDb if the client netDb does not exist
- Since:
- 0.9.61
-