Skip to content

Peer-to-peer reactive membership called swaplink implemented in Python

License

Notifications You must be signed in to change notification settings

aratz-lasa/py-swaplink

Repository files navigation

py-swaplink

Build Status codecov

Python 3.7 PEP8 black Checked with mypy

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

from swaplink import Swaplink

def 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 - Vivek Vishnumurthy and Paul Francis. On heterogeneous over-lay construction and random node selection in unstructured p2pnetworks. InProc. IEEE Infocom, 2006.
  • Swaplink evaluation paper - 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.

About

Peer-to-peer reactive membership called swaplink implemented in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages