All Implemented Interfaces:
Job

class FloodfillStoreJobextends StoreJob
This class extends StoreJob to fire off a FloodfillVerifyStoreJob after a successful store.

Stores through this class always request a reply.

  • Field Details

    • PROP_RI_VERIFY

      private static final String PROP_RI_VERIFY
      Property turning on the check that a stored router info is valid.
      See Also:
    • RI_VERIFY_STARTUP_TIME

      private static final long RI_VERIFY_STARTUP_TIME
      How long after startup the router info check is skipped - 90 minutes.
      See Also:
    • LOG_KEY_B32_LENGTH

      private static final int LOG_KEY_B32_LENGTH
      Length of Base32 key prefix for logging.
      See Also:
    • LOG_KEY_B64_LENGTH

      private static final int LOG_KEY_B64_LENGTH
      Length of Base64 key prefix for logging.
      See Also:
    • _facade

      private final FloodfillNetworkDatabaseFacade _facade
      The store the entry is saved to.
  • Constructor Details

    • FloodfillStoreJob

      public FloodfillStoreJob(RouterContext context, FloodfillNetworkDatabaseFacade facade, Hash key, DatabaseEntry data, Job onSuccess, Job onFailure, long timeoutMs)
      Create a new FloodfillStoreJob to send data to floodfills.
      Parameters:
      context - the router context supplying the job queue and database
      facade - the floodfill facade this job stores through
      key - the hash the entry is to be stored under
      data - the entry to store, a RouterInfo or LeaseSet
      onSuccess - job to queue once a floodfill acknowledges the store
      onFailure - job to queue if no floodfill replies before the timeout
      timeoutMs - how long to wait for an acknowledgement, in milliseconds
    • FloodfillStoreJob

      public FloodfillStoreJob(RouterContext context, FloodfillNetworkDatabaseFacade facade, Hash key, DatabaseEntry data, Job onSuccess, Job onFailure, long timeoutMs, Set<Hash> toSkip)
      Create a new FloodfillStoreJob to send data to floodfills.
      Parameters:
      context - the router context supplying the job queue and database
      facade - the floodfill facade this job stores through
      key - the hash the entry is to be stored under
      data - the entry to store, a RouterInfo or LeaseSet
      onSuccess - job to queue once a floodfill acknowledges the store
      onFailure - job to queue if no floodfill replies before the timeout
      timeoutMs - how long to wait for an acknowledgement, in milliseconds
      toSkip - set of peer hashes to skip (e.g., already have the data), may be null
  • Method Details

    • getParallelization

      protected int getParallelization()
      Description copied from class: StoreJob
      Maximum number of parallel store operations. Note: Overridden in Floodfill Search Job.
      Overrides:
      getParallelization in class StoreJob
      Returns:
      number of messages to send simultaneously
    • getRedundancy

      protected int getRedundancy()
      Description copied from class: StoreJob
      Required redundancy level for successful store. Note: Overridden in Floodfill Search Job.
      Overrides:
      getRedundancy in class StoreJob
      Returns:
      number of peers that must receive the data
    • succeed

      protected void succeed()
      Description copied from class: StoreJob
      Handle successful completion of the store operation.

      Called when the required redundancy level is reached.

      Overrides:
      succeed in class StoreJob
    • shouldSkipVerify

      private boolean shouldSkipVerify(Hash key, String keyB64, boolean shouldLog)
      Check if verify should be skipped due to existing verify or shutdown.
      Parameters:
      key - the key being stored, checked for an in-progress verify
      keyB64 - the key in Base64, used only in the log messages
      shouldLog - true to log the reason when verify is skipped
      Returns:
      whether skip verify
    • getPublishedTimestamp

      private long getPublishedTimestamp(DatabaseEntry data)
      The published timestamp from the data.
      Parameters:
      data - the entry stored, a LeaseSet2 or a dated entry
      Returns:
      the published timestamp
    • getClientHash

      private Hash getClientHash(DatabaseEntry data, Hash key)
      The client hash from the data, or the key if not available.
      Parameters:
      data - the entry stored, an encrypted LS2 carries the client's destination
      key - the key hash, returned when the entry has no client
      Returns:
      the client hash
    • getName

      public String getName()
      Description copied from class: StoreJob
      Name of this job for logging and debugging.
      Specified by:
      getName in interface Job
      Overrides:
      getName in class StoreJob
      Returns:
      job name