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 Details

  • Constructor Details

    • 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 Details

    • 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