Class DHTPluginStorageManager
java.lang.Object
com.biglybt.plugin.dht.impl.DHTPluginStorageManager
- All Implemented Interfaces:
DHTStorageAdapter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longprivate AEMonitorprivate AEMonitorprivate Fileprivate static final longprivate static final longprivate static final intprivate static final intprivate BloomFilterprivate longprivate ByteArrayHashMapprivate AEMonitorprivate static RSAPublicKeyprivate static final longprivate DHTStorageBlock[]static final intstatic final intstatic final intstatic final intprivate Mapprivate DHTLoggerstatic final intprivate static final Stringprivate intprivate static final Stringprivate Mapprivate Mapprivate intprivate intprivate AEMonitorprivate longprivate Mapprivate AEMonitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DHTStorageBlock[]protected DHTPluginStorageManager.diversificationcreateDiversification(HashWrapper wrapper, byte type) byte[][]createNewDiversification(String description, DHTTransportContact cause, byte[] key, boolean put_operation, byte diversification_type, boolean exhaustive, int max_depth) static DHTStorageKeyStatsprotected voidprotected voidstatic byte[]diversifyKey(byte[] key_in, int offset) static HashWrapperdiversifyKey(HashWrapper key_in, int offset) static byte[]diversifyKeyLocal(byte[] key_in, int offset) protected voidvoidexportContacts(DHT dht) protected byte[][]followDivChain(HashWrapper wrapper, boolean put_operation, boolean exhaustive, int max_depth) protected ListfollowDivChainSupport(List list_in, boolean put_operation, int depth, boolean exhaustive, List keys_done, int max_depth) protected static StringformatExpiry(long l) byte[][]getExistingDiversification(byte[] key, boolean put_operation, boolean exhaustive, int max_depth) getKeyBlockDetails(byte[] key) intbyte[]getKeyForKeyBlock(byte[] request) protected StringintintgetNextValueVersions(int num) intintbyte[]getStorageForKey(String key) protected DHTPluginStorageManager.storageKeygetStorageKey(HashWrapper key) voidimportContacts(DHT dht) booleanisDiversified(byte[] key) protected booleanisRecentAddress(String address) keyBlockRequest(DHTTransportContact originating_contact, byte[] request, byte[] signature) keyCreated(HashWrapper key, boolean local) Create a new storage key for a given keyvoidkeyDeleted(DHTStorageKey key) voidkeyRead(DHTStorageKey key, DHTTransportContact contact) protected voidlocalContactChanged(DHTTransportContact contact) protected DHTPluginStorageManager.diversificationlookupDiversification(HashWrapper wrapper) protected voidprotected voidprotected voidprotected MapreadMapFromFile(String file_prefix) protected voidprotected voidprotected voidrecordCurrentAddress(String address) voidvoidsetStorageForKey(String key, byte[] data) protected booleanvoidvalueAdded(DHTStorageKey key, DHTTransportValue value) voidvalueDeleted(DHTStorageKey key, DHTTransportValue value) voidvalueUpdated(DHTStorageKey key, DHTTransportValue old_value, DHTTransportValue new_value) static booleanverifyKeyBlock(byte[] request, byte[] signature) protected booleanverifyKeyBlock(DHTPluginStorageManager.keyBlock kb, DHTTransportContact originator) protected voidprotected voidprotected voidwriteMapToFile(Map map, String file_prefix) protected voidprotected void
-
Field Details
-
pub_exp
- See Also:
-
modulus
- See Also:
-
ADDRESS_EXPIRY
private static final long ADDRESS_EXPIRY- See Also:
-
DIV_WIDTH
private static final int DIV_WIDTH- See Also:
-
DIV_FRAG_GET_SIZE
private static final int DIV_FRAG_GET_SIZE- See Also:
-
DIV_EXPIRY_MIN
private static final long DIV_EXPIRY_MIN- See Also:
-
DIV_EXPIRY_RAND
private static final long DIV_EXPIRY_RAND- See Also:
-
KEY_BLOCK_TIMEOUT_SECS
private static final long KEY_BLOCK_TIMEOUT_SECS- See Also:
-
LOCAL_DIVERSIFICATION_SIZE_LIMIT
public static final int LOCAL_DIVERSIFICATION_SIZE_LIMIT- See Also:
-
LOCAL_DIVERSIFICATION_ENTRIES_LIMIT
public static final int LOCAL_DIVERSIFICATION_ENTRIES_LIMIT- See Also:
-
LOCAL_DIVERSIFICATION_READS_PER_MIN_SAMPLES
public static final int LOCAL_DIVERSIFICATION_READS_PER_MIN_SAMPLES- See Also:
-
LOCAL_DIVERSIFICATION_READS_PER_MIN
public static final int LOCAL_DIVERSIFICATION_READS_PER_MIN- See Also:
-
MAX_STORAGE_KEYS
public static final int MAX_STORAGE_KEYS- See Also:
-
network
private int network -
log
-
data_dir
-
address_mon
-
contact_mon
-
storage_mon
-
version_mon
-
key_block_mon
-
version_map
-
recent_addresses
-
remote_diversifications
-
local_storage_keys
-
remote_freq_div_count
private int remote_freq_div_count -
remote_size_div_count
private int remote_size_div_count -
key_block_map_cow
-
key_blocks_direct_cow
-
kb_verify_fail_bloom
-
kb_verify_fail_bloom_create_time
private long kb_verify_fail_bloom_create_time -
suspend_divs_until
private long suspend_divs_until -
key_block_public_key
-
-
Constructor Details
-
DHTPluginStorageManager
-
-
Method Details
-
getNetwork
public int getNetwork()- Specified by:
getNetworkin interfaceDHTStorageAdapter
-
importContacts
-
exportContacts
-
readRecentAddresses
protected void readRecentAddresses() -
writeRecentAddresses
protected void writeRecentAddresses() -
recordCurrentAddress
-
getMostRecentAddress
-
isRecentAddress
-
localContactChanged
-
readMapFromFile
-
writeMapToFile
-
readVersionData
protected void readVersionData() -
writeVersionData
protected void writeVersionData() -
getNextValueVersions
public int getNextValueVersions(int num) - Specified by:
getNextValueVersionsin interfaceDHTStorageAdapter
-
keyCreated
Description copied from interface:DHTStorageAdapterCreate a new storage key for a given key- Specified by:
keyCreatedin interfaceDHTStorageAdapter- Returns:
- null if the key shouldn't be allocated (e.g.out of space)
-
keyDeleted
- Specified by:
keyDeletedin interfaceDHTStorageAdapter
-
getKeyCount
public int getKeyCount()- Specified by:
getKeyCountin interfaceDHTStorageAdapter
-
keyRead
- Specified by:
keyReadin interfaceDHTStorageAdapter
-
serialiseStats
public void serialiseStats(DHTPluginStorageManager.storageKey key, DataOutputStream dos) throws IOException - Throws:
IOException
-
deserialiseStats
- Specified by:
deserialiseStatsin interfaceDHTStorageAdapter- Throws:
IOException
-
decodeStats
- Throws:
IOException
-
valueAdded
- Specified by:
valueAddedin interfaceDHTStorageAdapter
-
valueUpdated
public void valueUpdated(DHTStorageKey key, DHTTransportValue old_value, DHTTransportValue new_value) - Specified by:
valueUpdatedin interfaceDHTStorageAdapter
-
valueDeleted
- Specified by:
valueDeletedin interfaceDHTStorageAdapter
-
isDiversified
public boolean isDiversified(byte[] key) - Specified by:
isDiversifiedin interfaceDHTStorageAdapter
-
getExistingDiversification
public byte[][] getExistingDiversification(byte[] key, boolean put_operation, boolean exhaustive, int max_depth) - Specified by:
getExistingDiversificationin interfaceDHTStorageAdapter
-
createNewDiversification
public byte[][] createNewDiversification(String description, DHTTransportContact cause, byte[] key, boolean put_operation, byte diversification_type, boolean exhaustive, int max_depth) - Specified by:
createNewDiversificationin interfaceDHTStorageAdapter
-
followDivChain
protected byte[][] followDivChain(HashWrapper wrapper, boolean put_operation, boolean exhaustive, int max_depth) -
followDivChainSupport
-
getStorageKey
-
deleteStorageKey
-
suspendDivs
protected boolean suspendDivs() -
readDiversifications
protected void readDiversifications() -
writeDiversifications
protected void writeDiversifications() -
lookupDiversification
-
createDiversification
protected DHTPluginStorageManager.diversification createDiversification(HashWrapper wrapper, byte type) -
divAdded
-
divRemoved
-
getRemoteFreqDivCount
public int getRemoteFreqDivCount()- Specified by:
getRemoteFreqDivCountin interfaceDHTStorageAdapter
-
getRemoteSizeDivCount
public int getRemoteSizeDivCount()- Specified by:
getRemoteSizeDivCountin interfaceDHTStorageAdapter
-
formatExpiry
-
readKeyBlocks
protected void readKeyBlocks() -
buildKeyBlockDetails
-
writeKeyBlocks
protected void writeKeyBlocks() -
keyBlockRequest
public DHTStorageBlock keyBlockRequest(DHTTransportContact originating_contact, byte[] request, byte[] signature) - Specified by:
keyBlockRequestin interfaceDHTStorageAdapter
-
verifyKeyBlock
protected boolean verifyKeyBlock(DHTPluginStorageManager.keyBlock kb, DHTTransportContact originator) -
verifyKeyBlock
public static boolean verifyKeyBlock(byte[] request, byte[] signature) -
getKeyBlockDetails
- Specified by:
getKeyBlockDetailsin interfaceDHTStorageAdapter
-
getDirectKeyBlocks
- Specified by:
getDirectKeyBlocksin interfaceDHTStorageAdapter
-
getKeyForKeyBlock
public byte[] getKeyForKeyBlock(byte[] request) - Specified by:
getKeyForKeyBlockin interfaceDHTStorageAdapter
-
purgeDirectKeyBlocks
protected void purgeDirectKeyBlocks() -
setStorageForKey
- Specified by:
setStorageForKeyin interfaceDHTStorageAdapter
-
getStorageForKey
- Specified by:
getStorageForKeyin interfaceDHTStorageAdapter
-
diversifyKey
-
diversifyKey
public static byte[] diversifyKey(byte[] key_in, int offset) -
diversifyKeyLocal
public static byte[] diversifyKeyLocal(byte[] key_in, int offset)
-