class Torrents extends ConcurrentHashMap<InfoHash,Peers>
This class extends ConcurrentHashMap to provide a thread-safe mapping from torrent info hash to the collection of peers participating in each torrent. It represents the complete set of torrents that the DHT tracker is currently tracking, along with all known peers for each torrent.
This is the top-level data structure for the DHT tracker functionality. When peers announce themselves for torrents, they are added to the appropriate Peers collection within this structure. When get_peer requests are received, this structure is queried to find the relevant torrent and return its peers.
The concurrent implementation ensures thread safety when multiple DHT operations are accessing or modifying torrent and peer data simultaneously, which is essential for a high-performance DHT tracker.
ConcurrentHashMap.KeySetView<K,V>AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
Torrents()
Creates a new torrent collection with default initial capacity.
|
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesclonepublic Torrents()
Uses the default ConcurrentHashMap constructor which provides good performance characteristics for most DHT tracking scenarios. The map will automatically resize as needed to accommodate the number of tracked torrents.