net.i2p.router.networkdb.reseed
Class ReseedChecker

java.lang.Object
  extended by net.i2p.router.networkdb.reseed.ReseedChecker

public class ReseedChecker
extends Object

Moved from RouterConsoleRunner.java Reseeding is not strictly a router function, it used to be in the routerconsole app, but this made it impossible to bootstrap an embedded router lacking a routerconsole, in iMule or android for example, without additional modifications. Also, as this is now called from PersistentDataStore, not from the routerconsole, we can get started as soon as the netdb has read the netDb/ directory, not when the console starts.


Field Summary
static int MINIMUM
           
 
Constructor Summary
ReseedChecker(RouterContext context)
          All reseeding must be done through this instance.
 
Method Summary
 boolean checkReseed(int count)
          Check if a reseed is needed, and start it
(package private)  void done()
          The reseed is complete
 String getError()
          Error from last or current reseed attempt
 String getStatus()
          Status from current reseed attempt, probably empty if no reseed in progress.
 boolean inProgress()
          Is a reseed in progress?
 boolean requestReseed()
          Start a reseed
(package private)  void setError(String s)
          Status from last or current reseed attempt
(package private)  void setStatus(String s)
          Status from current reseed attempt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM

public static final int MINIMUM
See Also:
Constant Field Values
Constructor Detail

ReseedChecker

public ReseedChecker(RouterContext context)
All reseeding must be done through this instance. Access through context.netDb().reseedChecker(), others should not instantiate

Since:
0.9
Method Detail

checkReseed

public boolean checkReseed(int count)
Check if a reseed is needed, and start it

Parameters:
count - current number of known routers
Returns:
true if a reseed was started

requestReseed

public boolean requestReseed()
Start a reseed

Returns:
true if a reseed was started, false if already in progress
Since:
0.9

inProgress

public boolean inProgress()
Is a reseed in progress?

Since:
0.9

done

void done()
The reseed is complete

Since:
0.9

getStatus

public String getStatus()
Status from current reseed attempt, probably empty if no reseed in progress.

Returns:
non-null, may be empty
Since:
0.9

setStatus

void setStatus(String s)
Status from current reseed attempt

Parameters:
s - non-null, may be empty
Since:
0.9

getError

public String getError()
Error from last or current reseed attempt

Returns:
non-null, may be empty
Since:
0.9

setError

void setError(String s)
Status from last or current reseed attempt

Parameters:
s - non-null, may be empty
Since:
0.9