Class DHTImpl
java.lang.Object
com.biglybt.core.dht.impl.DHTImpl
- All Implemented Interfaces:
DHT, AERunStateHandler.RunStateChangeListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DHTControlprivate final CopyOnWriteList<DHTListener> private final DHTLoggerprivate DHTNATPuncherAdapterprivate DHTNATPuncherprivate final Propertiesprivate booleanprivate booleanprivate DHTSpeedTester(package private) final DHTStorageAdapterFields inherited from interface DHT
DT_FREQUENCY, DT_NONE, DT_SIZE, DT_STRINGS, FLAG_ANON, FLAG_BRIDGED, FLAG_DOWNLOADING, FLAG_HIGH_PRIORITY, FLAG_LOOKUP_FOR_STORE, FLAG_MULTI_VALUE, FLAG_NONE, FLAG_OBFUSCATE_LOOKUP, FLAG_PRECIOUS, FLAG_PUT_AND_FORGET, FLAG_SEEDING, FLAG_SINGLE_VALUE, FLAG_STATS, MAX_VALUE_SIZE, NW_AZ_CVS, NW_AZ_MAIN, NW_AZ_MAIN_V6, NW_BIGLYBT_MAIN, NW_MAIN, PR_CACHE_AT_CLOSEST_N, PR_CACHE_REPUBLISH_INTERVAL, PR_CONTACTS_PER_NODE, PR_ENABLE_RANDOM_LOOKUP, PR_ENCODE_KEYS, PR_LOOKUP_CONCURRENCY, PR_MAX_REPLACEMENTS_PER_NODE, PR_NODE_SPLIT_FACTOR, PR_ORIGINAL_REPUBLISH_INTERVAL, PR_SEARCH_CONCURRENCY, REP_FACT_DEFAULT, REP_FACT_NONE -
Constructor Summary
ConstructorsConstructorDescriptionDHTImpl(DHTTransport _transport, DHTRouter _router, DHTDB _database, Properties _properties, DHTStorageAdapter _storage_adapter, DHTLogger _logger) DHTImpl(DHTTransport _transport, Properties _properties, DHTStorageAdapter _storage_adapter, DHTNATPuncherAdapter _nat_adapter, DHTLogger _logger) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(DHTListener listener) voiddestroy()voidexportState(DataOutputStream os, int max) externalises information that allows the DHT to be recreated at a later date and populated via the import methodvoidget(byte[] key, String description, short flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTOperationListener listener) intgetIntProperty(String name) getLocalValue(byte[] key) Returns value if originated from here for keyprotected intgetStoredValues(byte[] key) voidpopulate the DHT with previously exported statevoidintegrate(boolean full_wait) Integrate the node into the DHT Can be invoked more than once if additional state is importedbooleanisDiversified(byte[] key) booleanvoidprint(boolean full) voidput(byte[] key, String description, byte[] value, short flags, boolean high_priority, DHTOperationListener listener) default is HIGH PRIORITY.voidput(byte[] key, String description, byte[] value, short flags, byte life_hours, boolean high_priority, DHTOperationListener listener) voidput(byte[] key, String description, byte[] value, short flags, byte life_hours, byte replication_control, boolean high_priority, DHTOperationListener listener) voidput(byte[] key, String description, byte[] value, short flags, DHTOperationListener listener) byte[]remove(byte[] key, String description, short flags, DHTOperationListener listener) byte[]remove(byte[] key, String description, DHTOperationListener listener) byte[]remove(DHTTransportContact[] contacts, byte[] key, String description, DHTOperationListener listener) voidremoveListener(DHTListener listener) voidrunStateChanged(long run_state) voidsetLogging(boolean on) voidsetSuspended(boolean susp)
-
Field Details
-
storage_adapter
-
nat_adapter
-
control
-
nat_puncher
-
speed_tester
-
properties
-
logger
-
listeners
-
runstate_startup
private boolean runstate_startup -
sleeping
private boolean sleeping
-
-
Constructor Details
-
DHTImpl
public DHTImpl(DHTTransport _transport, Properties _properties, DHTStorageAdapter _storage_adapter, DHTNATPuncherAdapter _nat_adapter, DHTLogger _logger) -
DHTImpl
public DHTImpl(DHTTransport _transport, DHTRouter _router, DHTDB _database, Properties _properties, DHTStorageAdapter _storage_adapter, DHTLogger _logger)
-
-
Method Details
-
runStateChanged
public void runStateChanged(long run_state) - Specified by:
runStateChangedin interfaceAERunStateHandler.RunStateChangeListener
-
isSleeping
public boolean isSleeping()- Specified by:
isSleepingin interfaceDHT
-
setSuspended
public void setSuspended(boolean susp) - Specified by:
setSuspendedin interfaceDHT
-
getProp
-
getIntProperty
- Specified by:
getIntPropertyin interfaceDHT
-
isDiversified
public boolean isDiversified(byte[] key) - Specified by:
isDiversifiedin interfaceDHT
-
put
public void put(byte[] key, String description, byte[] value, short flags, DHTOperationListener listener) -
put
public void put(byte[] key, String description, byte[] value, short flags, boolean high_priority, DHTOperationListener listener) Description copied from interface:DHTdefault is HIGH PRIORITY. if you change to low priority then do so consistently as operations can get out of order otherwise -
put
public void put(byte[] key, String description, byte[] value, short flags, byte life_hours, boolean high_priority, DHTOperationListener listener) -
put
public void put(byte[] key, String description, byte[] value, short flags, byte life_hours, byte replication_control, boolean high_priority, DHTOperationListener listener) -
getLocalValue
Description copied from interface:DHTReturns value if originated from here for key- Specified by:
getLocalValuein interfaceDHT- Parameters:
key-- Returns:
-
getStoredValues
- Specified by:
getStoredValuesin interfaceDHT
-
get
public void get(byte[] key, String description, short flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTOperationListener listener) -
remove
-
remove
-
remove
public byte[] remove(DHTTransportContact[] contacts, byte[] key, String description, DHTOperationListener listener) -
getTransport
- Specified by:
getTransportin interfaceDHT
-
getRouter
-
getControl
- Specified by:
getControlin interfaceDHT
-
getDataBase
- Specified by:
getDataBasein interfaceDHT
-
getNATPuncher
- Specified by:
getNATPuncherin interfaceDHT
-
getSpeedTester
-
getStorageAdapter
- Specified by:
getStorageAdapterin interfaceDHT
-
integrate
-
destroy
-
exportState
Description copied from interface:DHTexternalises information that allows the DHT to be recreated at a later date and populated via the import method- Specified by:
exportStatein interfaceDHT- Parameters:
os-max- maximum to export, 0 -> all- Throws:
IOException
-
importState
Description copied from interface:DHTpopulate the DHT with previously exported state- Specified by:
importStatein interfaceDHT- Parameters:
is-- Throws:
IOException
-
setLogging
public void setLogging(boolean on) - Specified by:
setLoggingin interfaceDHT
-
getLogger
-
print
-
addListener
- Specified by:
addListenerin interfaceDHT
-
removeListener
- Specified by:
removeListenerin interfaceDHT
-