This is a simple python package that uses the pyzmq library to create a number of peers on disjoint networks which can coalesce through a planned internet Lighthouse
.
Design was stream of conscious, issues are encouraged.
As follows:
RandomPeer(JsonPeer)
<- JsonPeer(WorkloadPeer)
<- WorkloadPeer(GroupPeer)
<- GroupPeer(Peer)
<- Peer(ABC)
RandomPeer(JsonPeer)
is a high level example of how to use the JsonPeer
and WorkloadPeer
classes as ABC bases.
-
At the Workload level, the
async workload_wrapper
coroutine abstractmethod must be implemented as well ashandle_workload
. These implmentations can be seen inJsonPeer
andRandomPeer
respectively. -
RandomPeer
is able to use it's methodshandle_work
andworkload
to create simple syncronous workloads which are asynchronously handled. -
GroupPeer
itself leaves the abstract methodbroadcast_loop
fromPeer(ABC)
to be implemented. This is overridden inWorkloadPeer
.
$ poetry install
$ zmqer --help
usage: zmqer [-h] [-lt {stdout,file,None}] [-v {DEBUG,INFO,WARNING,ERROR,CRITICAL,v}] [-la] [-psd PEER_SETUP_DELAY] [-n N_PEERS] [-nl N_LATE_START_PEERS] [-sp STARTING_PORT]
options:
-h, --help show this help message and exit
-lt {stdout,file,None}, --log-to {stdout,file,None}
Where to log output.
-v {DEBUG,INFO,WARNING,ERROR,CRITICAL,v}, --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL,v}
Logging level
-la, --log-all Log all messages, not just those from specified logging peers.
-psd PEER_SETUP_DELAY, --peer-setup-delay PEER_SETUP_DELAY
Delay in seconds before setting up late-start peers.
-n N_PEERS, --n-peers N_PEERS
Number of peers to instantiate.
-nl N_LATE_START_PEERS, --n-late-start-peers N_LATE_START_PEERS
Number of late-start peers to instantiate as a percentage of n_peers.
-sp STARTING_PORT, --starting-port STARTING_PORT
Starting port for peer addresses.
$ zmqer -vv
or if you would like to thrash your file system:
$ zmqer -vv -la -lt file