Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aratz-lasa/py-swaplink
Peer-to-peer reactive membership called swaplink implemented in Python
https://github.com/aratz-lasa/py-swaplink
Last synced: about 21 hours ago
JSON representation
Peer-to-peer reactive membership called swaplink implemented in Python
- Host: GitHub
- URL: https://github.com/aratz-lasa/py-swaplink
- Owner: aratz-lasa
- License: mit
- Created: 2019-10-17T20:54:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T06:44:28.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T14:47:12.913Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-swaplink
[![Build Status](https://travis-ci.com/aratz-lasa/py-swaplink.svg?branch=master)](https://travis-ci.com/aratz-lasa/py-swaplink)
[![codecov](https://codecov.io/gh/aratz-lasa/py-swaplink/branch/master/graph/badge.svg)](https://codecov.io/gh/aratz-lasa/py-swaplink)[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)swaplink implemented in Python.
## What is Swaplink
Swaplinks builds a random peer-to-peer unstructured overlay, in which each node’s degree is proportional to its desired degree capacity. Then, uses random walks over the generated random graph to do random node sampling.It gives quite-precise control over both the probability that a node is selected and the overhead of visited nodes when executing peer sampling.
It is efficient, scalable, robust and simple, while limiting tuning-knobs to just the 'desired-load'.
## Usage
```python
from swaplink import Swaplinkdef callback(neighbors):
...async def main():
host = "127.0.0.1"
port = 5678
num_links = 5 # relative load on your node
boostrap_nodes = [("127.0.0.1", 7777)]network = Swaplink(host, port)
await network.join(num_links, boostrap_nodes)
random_node = await network.select()
neighbors = network.list_neighbours(callback)
...
await network.leave()
```## References
* [Swaplink paper](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.365.9926) - Vivek Vishnumurthy and Paul Francis. On heterogeneous over-lay construction and random node selection in unstructured p2pnetworks. InProc. IEEE Infocom, 2006.
* [Swaplink evaluation paper](https://www.usenix.org/event/usenix07/tech/full_papers/vishnumurthy/vishnumurthy.pdf) - V. Vishnumurthy and P. Francis. A Comparison of Structured andUnstructured P2P Approaches to Heterogeneous Random Peer Selection.InProceedings of the USENIX Annual Technical Conference, pages 1–14, 2007.