This is a python implementation of the paxos consensus algorithm. It requires python version 3.4+ to leverage PEP 443 and PEP 3156.
You can install dependencies through pip.
$ pip3 install -r requirements.txt
You can install package using setup tools.
$ python setup.py install
You can configure the paxos.json for a set of replicas. Below is an example config of a 3 replica cluster for replica "192.168.0.1".
{
"address": "192.168.0.1",
"address_of_replicas": ["192.168.0.2", "192.168.0.3"],
}
An application running on each replica starts the paxos service by simply creating a Store instance.
>>> from paxos.app.store import Store
>>> store = Store()
We can replicate data by assigning and updating values on the store object. Basic python types are supported (e.g. lists, sets, dicts, ints).
>>> store.mylist = []
>>> store.mylist.append("Donald Duck")
We can access data by simply requesting the attribute previously assigned.
>>> store.mylist[0]
"Donald Duck"