To run apt-p2p, you probably want to do something like::
from apt_p2p.apt_p2p import AptP2P
- myapp = AptP2P(myDHT)
+ factory = AptP2P(DHT)
-where myDHT is a DHT that implements interfaces.IDHT.
+where DHT is a class that implements interfaces.IDHT.
Diagram of the interaction between the given modules::
- +---------------+ +-----------------------------------+ +-------------
- | AptP2P | | DHT | | Internet
- | |--->|join DHT|----|--\
- | |--->|loadConfig | | | Another
- | |--->|getValue | | | Node
- | |--->|storeValue DHT|<---|--/
- | |--->|leave | |
- | | +-----------------------------------+ |
- | | +-------------+ +----------------+ |
- | | | PeerManager | | HTTPDownloader*| |
- | |--->|get |--->|get HTTP|----|---> Mirror
- | | | |--->|getRange | |
- | |--->|close |--->|close HTTP|----|--\
- | | +-------------+ +----------------+ | | Another
- | | +-----------------------------------+ | | Peer
- | | | HTTPServer HTTP|<---|--/
- | |--->|getHTTPFactory | +-------------
- |check_freshness|<---| | +-------------
+ +---------------+ +-------------+ +----------------+ +-------------
+ | AptP2P | | DHTManager | | IDHT | |
+ | |--->|start |--->|join DHT|----|--\
+ | | | |--->|loadConfig | | | Another
+ | |--->|get |--->|getValue | | | Node
+ | |--->|store |--->|storeValue DHT|<---|--/
+ | | | |--->|leave | |
+ | /-----|--->|getStats |--->|getStats | |
+ | | | +-------------+ +----------------+ | Internet
+ | | | +-------------+ +----------------+ |
+ | | | | PeerManager | | HTTPDownloader*| |
+ | | |--->|get |--->|get HTTP|----|---> Mirror
+ | | | | |--->|getRange | |
+ | | |--->|close |--->|close HTTP|----|--\
+ | | | +-------------+ +----------------+ | | Another
+ | | | +-----------------------------------+ | | Peer
+ | | | | HTTPServer HTTP|<---|--/
+ | | | | | +-------------
+ | getStats|<---| | +-------------
| get_resp|<---| HTTP|<---|HTTP Request
| | +-----------------------------------+ |
| | +---------------+ +--------------+ | Local Net