Skip to content

Commit 51e8184

Browse files
committed
update readme with limitations
1 parent 1a0f711 commit 51e8184

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,40 @@ Fall 2024.
2121

2222

2323
## Usage
24-
to stay consistent with the language from the original paper, we recommend
24+
To stay consistent with the language from the original paper, we recommend
2525
naming your chordnet attribute `ring`:
2626
```python
2727
from chordnet import ChordNet
2828

2929
ring = new ChordNet(...)
30-
ring.create()
31-
# or ring.join(...)
32-
#...
30+
ring.create() # or ring.join(...)
31+
#...application logic...
3332
ring.leave()
33+
# end program
3434
```
3535
This fits with the concept of "joining" an existing ring network, or creating a
3636
new one. Examples follow this practice.
37+
38+
At present, this package only supports IP lookup. All application-dependent
39+
logic (state transfer, etc) must be handled by the application.
40+
The easiest way to do this is to initialize ChordNet as an attribute on
41+
an application class:
42+
```python
43+
class App:
44+
def __init__(self, ip: str, chordnet_port: int) -> None:
45+
self._ring = ChordNet(ip, chordnet_port)
46+
47+
def start(
48+
self, ip = None: str | None, port = None: int | None
49+
) -> None:
50+
if ip and port:
51+
self._ring.join(ip, port)
52+
elif not ip and not port:
53+
self._ring.create()
54+
else:
55+
print("need both or neither")
56+
return
57+
def stop(self) -> None:
58+
self._ring.leave()
59+
```
60+
In future versions, we hope to support in-package state transfer.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "chordnet"
3-
version = "2.2.0"
3+
version = "2.2.1"
44
license = "MIT"
55
license-files = ["LICENSE"]
66
description = "Implementation of the chord peer-to-peer networking protocol, introduced by Stoica et al."

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)