java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.StoreJob
net.i2p.router.networkdb.kademlia.FloodfillStoreJob
- All Implemented Interfaces:
Job
This class extends StoreJob to fire off a FloodfillVerifyStoreJob after a successful store.
Stores through this class always request a reply.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FloodfillNetworkDatabaseFacadeThe store the entry is saved to.private static final intLength of Base32 key prefix for logging.private static final intLength of Base64 key prefix for logging.private static final StringProperty turning on the check that a stored router info is valid.private static final longHow long after startup the router info check is skipped - 90 minutes.Fields inherited from class StoreJob
_log, _state, MIN_STORE_ENCLS2_VERSION, MIN_STORE_LS2_VERSION, MIN_STORE_VERSIONModifier and TypeFieldDescriptionprotected final LogLogger for this class.protected final StoreStateCurrent state of the store operation.static final StringWas supported in 38, but they're now sigtype 11 which wasn't added until 39.static final StringMinimum version for LS2 stores.static final StringShort ECIES tunnel build messages (1.5.0).Constructor Summary
ConstructorsConstructorDescriptionFloodfillStoreJob(RouterContext context, FloodfillNetworkDatabaseFacade facade, Hash key, DatabaseEntry data, Job onSuccess, Job onFailure, long timeoutMs) Create a new FloodfillStoreJob to send data to floodfills.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.Method Summary
Modifier and TypeMethodDescriptionprivate HashgetClientHash(DatabaseEntry data, Hash key) The client hash from the data, or the key if not available.getName()Name of this job for logging and debugging.protected intMaximum number of parallel store operations.private longThe published timestamp from the data.protected intRequired redundancy level for successful store.private booleanshouldSkipVerify(Hash key, String keyB64, boolean shouldLog) Check if verify should be skipped due to existing verify or shutdown.protected voidsucceed()Handle successful completion of the store operation.Methods inherited from class StoreJob
fail, runJob, shouldStoreEncLS2To, shouldStoreLS2To, shouldStoreToModifier and TypeMethodDescriptionprotected voidfail()Handle failed completion of the store operation.voidrunJob()Execute the job to start sending to the next batch of peers.(package private) static booleanIs it new enough?(package private) static booleanIs it new enough?(package private) static booleanIs it new enough?Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
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_TIMEHow long after startup the router info check is skipped - 90 minutes.- See Also:
LOG_KEY_B32_LENGTH
private static final int LOG_KEY_B32_LENGTHLength of Base32 key prefix for logging.- See Also:
LOG_KEY_B64_LENGTH
private static final int LOG_KEY_B64_LENGTHLength of Base64 key prefix for logging.- See Also:
_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 databasefacade- the floodfill facade this job stores throughkey- the hash the entry is to be stored underdata- the entry to store, a RouterInfo or LeaseSetonSuccess- job to queue once a floodfill acknowledges the storeonFailure- job to queue if no floodfill replies before the timeouttimeoutMs- 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 databasefacade- the floodfill facade this job stores throughkey- the hash the entry is to be stored underdata- the entry to store, a RouterInfo or LeaseSetonSuccess- job to queue once a floodfill acknowledges the storeonFailure- job to queue if no floodfill replies before the timeouttimeoutMs- how long to wait for an acknowledgement, in millisecondstoSkip- 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:StoreJobMaximum number of parallel store operations. Note: Overridden in Floodfill Search Job.- Overrides:
getParallelizationin classStoreJob- Returns:
- number of messages to send simultaneously
getRedundancy
protected int getRedundancy()Description copied from class:StoreJobRequired redundancy level for successful store. Note: Overridden in Floodfill Search Job.- Overrides:
getRedundancyin classStoreJob- Returns:
- number of peers that must receive the data
succeed
shouldSkipVerify
Check if verify should be skipped due to existing verify or shutdown.- Parameters:
key- the key being stored, checked for an in-progress verifykeyB64- the key in Base64, used only in the log messagesshouldLog- true to log the reason when verify is skipped- Returns:
- whether skip verify
getPublishedTimestamp
The published timestamp from the data.- Parameters:
data- the entry stored, a LeaseSet2 or a dated entry- Returns:
- the published timestamp
getClientHash
The client hash from the data, or the key if not available.- Parameters:
data- the entry stored, an encrypted LS2 carries the client's destinationkey- the key hash, returned when the entry has no client- Returns:
- the client hash
getName