Class PersistentDataStore
java.lang.Object
net.i2p.router.networkdb.kademlia.TransientDataStore
net.i2p.router.networkdb.kademlia.PersistentDataStore
- All Implemented Interfaces:
DataStore
Write out keys to disk when we get them and periodically read ones we don't know
about into memory, with newly read routers are also added to the routing table.
Public only for access to static methods by startup classes
-
Field Summary
Fields inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
_context, _log
-
Constructor Summary
ConstructorDescriptionPersistentDataStore
(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade) -
Method Summary
Modifier and TypeMethodDescriptionPrepare for having only a partial set in memory and the rest on diskstatic File
getRouterInfoFile
(RouterContext ctx, Hash hash) The persistent RI file for a hash.(package private) static Hash
getRouterInfoHash
(String filename) Package private for installer BundleRouterInfosboolean
boolean
put
(Hash key, DatabaseEntry data) boolean
put
(Hash key, DatabaseEntry data, boolean persist) for PersistentDataStore only - don't use herefor PersistentDataStore only - don't use herevoid
rescan()
void
restart()
void
stop()
Methods inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
countLeaseSets, getEntries, getKeys, getMapEntries, isKnown, size, toString
-
Field Details
-
DIR_PREFIX
- See Also:
-
RI_FILTER
- Since:
- 0.9.34
-
-
Constructor Details
-
PersistentDataStore
public PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade) throws IOException - Parameters:
dbDir
- relative path- Throws:
IOException
-
-
Method Details
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceDataStore
- Overrides:
isInitialized
in classTransientDataStore
-
stop
public void stop()- Specified by:
stop
in interfaceDataStore
- Overrides:
stop
in classTransientDataStore
-
restart
public void restart()- Specified by:
restart
in interfaceDataStore
- Overrides:
restart
in classTransientDataStore
-
rescan
public void rescan()- Specified by:
rescan
in interfaceDataStore
- Overrides:
rescan
in classTransientDataStore
-
get
- Specified by:
get
in interfaceDataStore
- Overrides:
get
in classTransientDataStore
-
get
Prepare for having only a partial set in memory and the rest on disk- Specified by:
get
in interfaceDataStore
- Overrides:
get
in classTransientDataStore
- Parameters:
persist
- if false, call super only, don't access disk
-
remove
- Specified by:
remove
in interfaceDataStore
- Overrides:
remove
in classTransientDataStore
-
remove
Description copied from class:TransientDataStore
for PersistentDataStore only - don't use here- Specified by:
remove
in interfaceDataStore
- Overrides:
remove
in classTransientDataStore
-
put
- Specified by:
put
in interfaceDataStore
- Overrides:
put
in classTransientDataStore
- Parameters:
data
- must be validated before here- Returns:
- success
-
put
Description copied from class:TransientDataStore
for PersistentDataStore only - don't use here- Specified by:
put
in interfaceDataStore
- Overrides:
put
in classTransientDataStore
-
getRouterInfoFile
The persistent RI file for a hash. This is available before the netdb subsystem is running, so we can delete our old RI.- Returns:
- non-null, should be absolute, does not necessarily exist
- Since:
- 0.9.23
-
getRouterInfoHash
Package private for installer BundleRouterInfos
-