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()
          .
 boolean requestReseed()
          Start a reseed
 int requestReseed(InputStream in)
          Reseed from a zip or su3 input stream.
 boolean requestReseed(URL url)
          Start a reseed from a zip or su3 URI.
(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

requestReseed

public boolean requestReseed(URL url)
                      throws IllegalArgumentException
Start a reseed from a zip or su3 URI.

Returns:
true if a reseed was started, false if already in progress
Throws:
IllegalArgumentException - if it doesn't end with zip or su3
Since:
0.9.19

requestReseed

public int requestReseed(InputStream in)
                  throws IOException
Reseed from a zip or su3 input stream. Blocking.

Returns:
true if a reseed was started, false if already in progress
Throws:
IOException - if already in progress or on most other errors
Since:
0.9.19

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. May include HTML.

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. May include HTML.

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