Package net.i2p.router.networkdb.reseed
Class ReseedChecker
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description static int
MINIMUM
-
Constructor Summary
Constructors Constructor Description ReseedChecker(RouterContext context)
All reseeding must be done through this instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkReseed(int count)
Check if a reseed is needed, and start it(package private) void
done()
The reseed is completeString
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 reseedint
requestReseed(InputStream in)
Reseed from a zip or su3 input stream.boolean
requestReseed(URI 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
-
-
-
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, includes us- 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(URI 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
-
-