Package com.biglybt.plugin.dht.impl
Class DHTPluginStorageManager
java.lang.Object
com.biglybt.plugin.dht.impl.DHTPluginStorageManager
- All Implemented Interfaces:
DHTStorageAdapter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
protected static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private AEMonitor
private AEMonitor
private File
private static final long
private static final long
private static final int
private static final int
private BloomFilter
private long
private ByteArrayHashMap
private AEMonitor
private static RSAPublicKey
private static final long
private DHTStorageBlock[]
static final int
static final int
static final int
static final int
private Map
private DHTLogger
static final int
private static final String
private int
private static final String
private Map
private Map
private int
private int
private AEMonitor
private long
private Map
private AEMonitor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DHTStorageBlock[]
protected DHTPluginStorageManager.diversification
createDiversification
(HashWrapper wrapper, byte type) byte[][]
createNewDiversification
(String description, DHTTransportContact cause, byte[] key, boolean put_operation, byte diversification_type, boolean exhaustive, int max_depth) static DHTStorageKeyStats
protected void
protected void
static byte[]
diversifyKey
(byte[] key_in, int offset) static HashWrapper
diversifyKey
(HashWrapper key_in, int offset) static byte[]
diversifyKeyLocal
(byte[] key_in, int offset) protected void
void
exportContacts
(DHT dht) protected byte[][]
followDivChain
(HashWrapper wrapper, boolean put_operation, boolean exhaustive, int max_depth) protected List
followDivChainSupport
(List list_in, boolean put_operation, int depth, boolean exhaustive, List keys_done, int max_depth) protected static String
formatExpiry
(long l) byte[][]
getExistingDiversification
(byte[] key, boolean put_operation, boolean exhaustive, int max_depth) getKeyBlockDetails
(byte[] key) int
byte[]
getKeyForKeyBlock
(byte[] request) protected String
int
int
getNextValueVersions
(int num) int
int
byte[]
getStorageForKey
(String key) protected DHTPluginStorageManager.storageKey
getStorageKey
(HashWrapper key) void
importContacts
(DHT dht) boolean
isDiversified
(byte[] key) protected boolean
isRecentAddress
(String address) keyBlockRequest
(DHTTransportContact originating_contact, byte[] request, byte[] signature) keyCreated
(HashWrapper key, boolean local) Create a new storage key for a given keyvoid
keyDeleted
(DHTStorageKey key) void
keyRead
(DHTStorageKey key, DHTTransportContact contact) protected void
localContactChanged
(DHTTransportContact contact) protected DHTPluginStorageManager.diversification
lookupDiversification
(HashWrapper wrapper) protected void
protected void
protected void
protected Map
readMapFromFile
(String file_prefix) protected void
protected void
protected void
recordCurrentAddress
(String address) void
void
setStorageForKey
(String key, byte[] data) protected boolean
void
valueAdded
(DHTStorageKey key, DHTTransportValue value) void
valueDeleted
(DHTStorageKey key, DHTTransportValue value) void
valueUpdated
(DHTStorageKey key, DHTTransportValue old_value, DHTTransportValue new_value) static boolean
verifyKeyBlock
(byte[] request, byte[] signature) protected boolean
verifyKeyBlock
(DHTPluginStorageManager.keyBlock kb, DHTTransportContact originator) protected void
protected void
protected void
writeMapToFile
(Map map, String file_prefix) protected void
protected 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:
getNetwork
in 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:
getNextValueVersions
in interfaceDHTStorageAdapter
-
keyCreated
Description copied from interface:DHTStorageAdapter
Create a new storage key for a given key- Specified by:
keyCreated
in interfaceDHTStorageAdapter
- Returns:
- null if the key shouldn't be allocated (e.g.out of space)
-
keyDeleted
- Specified by:
keyDeleted
in interfaceDHTStorageAdapter
-
getKeyCount
public int getKeyCount()- Specified by:
getKeyCount
in interfaceDHTStorageAdapter
-
keyRead
- Specified by:
keyRead
in interfaceDHTStorageAdapter
-
serialiseStats
public void serialiseStats(DHTPluginStorageManager.storageKey key, DataOutputStream dos) throws IOException - Throws:
IOException
-
deserialiseStats
- Specified by:
deserialiseStats
in interfaceDHTStorageAdapter
- Throws:
IOException
-
decodeStats
- Throws:
IOException
-
valueAdded
- Specified by:
valueAdded
in interfaceDHTStorageAdapter
-
valueUpdated
public void valueUpdated(DHTStorageKey key, DHTTransportValue old_value, DHTTransportValue new_value) - Specified by:
valueUpdated
in interfaceDHTStorageAdapter
-
valueDeleted
- Specified by:
valueDeleted
in interfaceDHTStorageAdapter
-
isDiversified
public boolean isDiversified(byte[] key) - Specified by:
isDiversified
in interfaceDHTStorageAdapter
-
getExistingDiversification
public byte[][] getExistingDiversification(byte[] key, boolean put_operation, boolean exhaustive, int max_depth) - Specified by:
getExistingDiversification
in interfaceDHTStorageAdapter
-
createNewDiversification
public byte[][] createNewDiversification(String description, DHTTransportContact cause, byte[] key, boolean put_operation, byte diversification_type, boolean exhaustive, int max_depth) - Specified by:
createNewDiversification
in 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:
getRemoteFreqDivCount
in interfaceDHTStorageAdapter
-
getRemoteSizeDivCount
public int getRemoteSizeDivCount()- Specified by:
getRemoteSizeDivCount
in interfaceDHTStorageAdapter
-
formatExpiry
-
readKeyBlocks
protected void readKeyBlocks() -
buildKeyBlockDetails
-
writeKeyBlocks
protected void writeKeyBlocks() -
keyBlockRequest
public DHTStorageBlock keyBlockRequest(DHTTransportContact originating_contact, byte[] request, byte[] signature) - Specified by:
keyBlockRequest
in interfaceDHTStorageAdapter
-
verifyKeyBlock
protected boolean verifyKeyBlock(DHTPluginStorageManager.keyBlock kb, DHTTransportContact originator) -
verifyKeyBlock
public static boolean verifyKeyBlock(byte[] request, byte[] signature) -
getKeyBlockDetails
- Specified by:
getKeyBlockDetails
in interfaceDHTStorageAdapter
-
getDirectKeyBlocks
- Specified by:
getDirectKeyBlocks
in interfaceDHTStorageAdapter
-
getKeyForKeyBlock
public byte[] getKeyForKeyBlock(byte[] request) - Specified by:
getKeyForKeyBlock
in interfaceDHTStorageAdapter
-
purgeDirectKeyBlocks
protected void purgeDirectKeyBlocks() -
setStorageForKey
- Specified by:
setStorageForKey
in interfaceDHTStorageAdapter
-
getStorageForKey
- Specified by:
getStorageForKey
in interfaceDHTStorageAdapter
-
diversifyKey
-
diversifyKey
public static byte[] diversifyKey(byte[] key_in, int offset) -
diversifyKeyLocal
public static byte[] diversifyKeyLocal(byte[] key_in, int offset)
-