pybitmessage.randomtrackingdict module¶
Track randomize ordered dict
-
class
RandomTrackingDict
[source]¶ Bases:
object
Dict with randomised order and tracking.
Keeps a track of how many items have been requested from the dict, and timeouts. Resets after all objects have been retrieved and timed out. The main purpose of this isn’t as much putting related code together as performance optimisation and anonymisation of downloading of objects from other peers. If done using a standard dict or array, it takes too much CPU (and looks convoluted). Randomisation helps with anonymity.
-
maxPending
= 10¶
-
pendingTimeout
= 60¶
-
setMaxPending
(maxPending)¶ Sets maximum number of objects that can be retrieved from the class simultaneously as long as there is no timeout
-
setPendingTimeout
(pendingTimeout)¶ Sets how long to wait for a timeout if max pending is reached (or all objects have been retrieved)
-
setLastObject
()¶ Update timestamp for tracking of received objects
-
randomKeys
(count=1)¶ Retrieve count random keys from the dict that haven’t already been retrieved
-