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-
Fields inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
_context, _log
-
-
Constructor Summary
Constructors Constructor Description PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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 Detail
-
DIR_PREFIX
static final String DIR_PREFIX
- See Also:
- Constant Field Values
-
RI_FILTER
public static final FileFilter RI_FILTER
- Since:
- 0.9.34
-
-
Constructor Detail
-
PersistentDataStore
public PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade) throws IOException
- Parameters:
dbDir- relative path- Throws:
IOException
-
-
Method Detail
-
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
public DatabaseEntry get(Hash key)
- Specified by:
getin interfaceDataStore- Overrides:
getin classTransientDataStore
-
get
public DatabaseEntry get(Hash key, boolean persist)
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
public DatabaseEntry remove(Hash key)
- Specified by:
removein interfaceDataStore- Overrides:
removein classTransientDataStore
-
remove
public DatabaseEntry remove(Hash key, boolean persist)
Description copied from class:TransientDataStorefor PersistentDataStore only - don't use here- Specified by:
removein interfaceDataStore- Overrides:
removein classTransientDataStore
-
put
public boolean put(Hash key, DatabaseEntry data)
- Specified by:
putin interfaceDataStore- Overrides:
putin classTransientDataStoredata- must be validated before here- Returns:
- success
-
put
public boolean put(Hash key, DatabaseEntry data, boolean persist)
Description copied from class:TransientDataStorefor PersistentDataStore only - don't use here- Specified by:
putin interfaceDataStore- Overrides:
putin classTransientDataStore
-
getRouterInfoFile
public static File getRouterInfoFile(RouterContext ctx, Hash hash)
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
-
-