Class PersistentDataStore
java.lang.Object
net.i2p.router.networkdb.kademlia.TransientDataStore
net.i2p.router.networkdb.kademlia.PersistentDataStore
- All Implemented Interfaces:
DataStore
public class PersistentDataStore extends TransientDataStore
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 Modifier and Type Field Description (package private) static StringDIR_PREFIXstatic FileFilterRI_FILTER -
Constructor Summary
Constructors Constructor Description PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade) -
Method Summary
Modifier and Type Method Description DatabaseEntryget(Hash key)DatabaseEntryget(Hash key, boolean persist)Prepare for having only a partial set in memory and the rest on diskstatic FilegetRouterInfoFile(RouterContext ctx, Hash hash)The persistent RI file for a hash.(package private) static HashgetRouterInfoHash(String filename)Package private for installer BundleRouterInfosbooleanisInitialized()booleanput(Hash key, DatabaseEntry data)booleanput(Hash key, DatabaseEntry data, boolean persist)for PersistentDataStore only - don't use hereDatabaseEntryremove(Hash key)DatabaseEntryremove(Hash key, boolean persist)for PersistentDataStore only - don't use herevoidrescan()voidrestart()voidstop()Methods inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
countLeaseSets, getEntries, getKeys, getMapEntries, isKnown, size, toString
-
Field Details
-
DIR_PREFIX
- See Also:
- Constant Field Values
-
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:
isInitializedin interfaceDataStore- Overrides:
isInitializedin classTransientDataStore
-
stop
public void stop()- Specified by:
stopin interfaceDataStore- Overrides:
stopin classTransientDataStore
-
restart
public void restart()- Specified by:
restartin interfaceDataStore- Overrides:
restartin classTransientDataStore
-
rescan
public void rescan()- Specified by:
rescanin interfaceDataStore- Overrides:
rescanin classTransientDataStore
-
get
- Specified by:
getin interfaceDataStore- Overrides:
getin classTransientDataStore
-
get
Prepare for having only a partial set in memory and the rest on disk- Specified by:
getin interfaceDataStore- Overrides:
getin classTransientDataStore- Parameters:
persist- if false, call super only, don't access disk
-
remove
- Specified by:
removein interfaceDataStore- Overrides:
removein classTransientDataStore
-
remove
Description copied from class:TransientDataStorefor PersistentDataStore only - don't use here- Specified by:
removein interfaceDataStore- Overrides:
removein classTransientDataStore
-
put
- Specified by:
putin interfaceDataStore- Overrides:
putin classTransientDataStoredata- must be validated before here- Returns:
- success
-
put
Description copied from class:TransientDataStorefor PersistentDataStore only - don't use here- Specified by:
putin interfaceDataStore- Overrides:
putin 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
-