net.i2p.router.networkdb.kademlia
Class PersistentDataStore
java.lang.Object
net.i2p.router.networkdb.kademlia.TransientDataStore
net.i2p.router.networkdb.kademlia.PersistentDataStore
- All Implemented Interfaces:
- DataStore
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.
PersistentDataStore
public PersistentDataStore(RouterContext ctx,
String dbDir,
KademliaNetworkDatabaseFacade facade)
throws IOException
- Parameters:
dbDir - relative path
- Throws:
IOException
isInitialized
public boolean isInitialized()
- Specified by:
isInitialized in interface DataStore- Overrides:
isInitialized in class TransientDataStore
stop
public void stop()
- Specified by:
stop in interface DataStore- Overrides:
stop in class TransientDataStore
restart
public void restart()
- Specified by:
restart in interface DataStore- Overrides:
restart in class TransientDataStore
rescan
public void rescan()
- Specified by:
rescan in interface DataStore- Overrides:
rescan in class TransientDataStore
get
public DatabaseEntry get(Hash key)
- Specified by:
get in interface DataStore- Overrides:
get in class TransientDataStore
get
public DatabaseEntry get(Hash key,
boolean persist)
- Prepare for having only a partial set in memory and the rest on disk
- Specified by:
get in interface DataStore- Overrides:
get in class TransientDataStore
- Parameters:
persist - if false, call super only, don't access disk
remove
public DatabaseEntry remove(Hash key)
- Specified by:
remove in interface DataStore- Overrides:
remove in class TransientDataStore
remove
public DatabaseEntry remove(Hash key,
boolean persist)
- Description copied from class:
TransientDataStore
- for PersistentDataStore only - don't use here
- Specified by:
remove in interface DataStore- Overrides:
remove in class TransientDataStore
put
public boolean put(Hash key,
DatabaseEntry data)
- Specified by:
put in interface DataStore- Overrides:
put in class TransientDataStore
data - must be validated before here
- Returns:
- success
put
public boolean put(Hash key,
DatabaseEntry data,
boolean persist)
- Description copied from class:
TransientDataStore
- for PersistentDataStore only - don't use here @throws IAE always
- Specified by:
put in interface DataStore- Overrides:
put in class TransientDataStore