Skip to main content

Implementation of the chord peer-to-peer networking protocol, introduced by Stoica et al.

Project description

ChordNet

GitHub Actions Workflow Status GitHub Actions Workflow Status

GitHub License PyPI - Types PyPI - Version PyPI - Downloads PyPI - Python Version PyPI - Implementation

Python implementation of the chord protocol, introduced by Stoica et al. This library began as a group project for cs536 at Purdue University in Fall 2024.

Installation

pip install chordnet

uv add chordnet

Usage

To stay consistent with the language from the original paper, we recommend naming your chordnet attribute ring:

from chordnet import ChordNet

ring = new ChordNet(...)
ring.create() # or ring.join(...)
#...application logic...
ring.leave()
# end program

This fits with the concept of "joining" an existing ring network, or creating a new one. Examples follow this practice.

At present, this package only supports IP lookup. All application-dependent logic (state transfer, etc) must be handled by the application. The easiest way to do this is to initialize ChordNet as an attribute on an application class:

class App:
    """An example/template application that uses ChordNet."""
    def __init__(self, ip: str, chordnet_port: int) -> None:
        """Creates a new insance of the app."""
        self._ring = ChordNet(ip, chordnet_port)

    def start(
        self, ip = None: str | None, port = None: int | None
    ) -> None:
        """Starts the app by joining an existing ring or creating a new one."""
        if ip and port:
            self._ring.join(ip, port)
            # ...any state transfer logic, if part of this app...
        elif not ip and not port:
            self._ring.create()
        else:
            print("need both or neither")
            return

    #...application logic (probably using self._ring.lookup()...

    def stop(self) -> None:
        """Gracefully leaves the ring."""
        # ...any state transfer logic (if using)...
        self._ring.leave()

Not all distributed applications that ChordNet is suitable for will require state transfer logic (for example, search problems), and the nature of that logic will likely vary by app. In future versions, we hope to support in-library state transfer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chordnet-2.2.2.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chordnet-2.2.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file chordnet-2.2.2.tar.gz.

File metadata

  • Download URL: chordnet-2.2.2.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chordnet-2.2.2.tar.gz
Algorithm Hash digest
SHA256 3167741fd159cbe11ad629331c71aa2e047f9caacb190466c7fae9a0337d4d94
MD5 a338d65c545af6ac135da14e82b40e4f
BLAKE2b-256 83ab5c2d0ee175b5c68901901af20de917ece3db470ba6916205acfa2cd28170

See more details on using hashes here.

Provenance

The following attestation bundles were made for chordnet-2.2.2.tar.gz:

Publisher: release.yml on jacklowrie/chordnet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chordnet-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: chordnet-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chordnet-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c456b4e97538ccd49fa1ca54bce15840c641e2f3a92c9f0a97509fad3dd7b8f8
MD5 59bccb1af9ebb97cdf6d9e954411b47d
BLAKE2b-256 24bf17c3f016dea8ed41274a7cbbd0d0303c9897ebf450e9c88dbe551e2ff2cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for chordnet-2.2.2-py3-none-any.whl:

Publisher: release.yml on jacklowrie/chordnet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page