net.i2p.router.networkdb.kademlia
Class PersistentDataStore

java.lang.Object
  extended by net.i2p.router.networkdb.kademlia.TransientDataStore
      extended by 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.


Field Summary
 
Fields inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
_context
 
Constructor Summary
PersistentDataStore(RouterContext ctx, java.lang.String dbDir, KademliaNetworkDatabaseFacade facade)
           
 
Method Summary
 DataStructure get(Hash key)
           
 DataStructure get(Hash key, boolean persist)
          Prepare for having only a partial set in memory and the rest on disk
 boolean isInitialized()
           
 boolean put(Hash key, DataStructure data)
           
 boolean put(Hash key, DataStructure data, boolean persist)
          for PersistentDataStore only - don't use here @throws IAE always
 DataStructure remove(Hash key)
           
 DataStructure remove(Hash key, boolean persist)
          for PersistentDataStore only - don't use here
 void rescan()
           
 void restart()
           
 void stop()
           
 
Methods inherited from class net.i2p.router.networkdb.kademlia.TransientDataStore
countLeaseSets, equals, getKeys, hashCode, isKnown, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistentDataStore

public PersistentDataStore(RouterContext ctx,
                           java.lang.String dbDir,
                           KademliaNetworkDatabaseFacade facade)
Method Detail

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 DataStructure get(Hash key)
Specified by:
get in interface DataStore
Overrides:
get in class TransientDataStore

get

public DataStructure 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 DataStructure remove(Hash key)
Specified by:
remove in interface DataStore
Overrides:
remove in class TransientDataStore

remove

public DataStructure 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,
                   DataStructure 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,
                   DataStructure 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