File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -41,20 +41,32 @@ The easiest way to do this is to initialize ChordNet as an attribute on
4141an application class:
4242``` python
4343class App :
44+ """ An example/template application that uses ChordNet."""
4445 def __init__ (self , ip : str , chordnet_port : int ) -> None :
46+ """ Creates a new insance of the app."""
4547 self ._ring = ChordNet(ip, chordnet_port)
4648
4749 def start (
4850 self , ip = None : str | None , port = None : int | None
4951 ) -> None :
52+ """ Starts the app by joining an existing ring or creating a new one."""
5053 if ip and port:
5154 self ._ring.join(ip, port)
55+ # ...any state transfer logic, if part of this app...
5256 elif not ip and not port:
5357 self ._ring.create()
5458 else :
5559 print (" need both or neither" )
5660 return
61+
62+ # ...application logic (probably using self._ring.lookup()...
63+
5764 def stop (self ) -> None :
65+ """ Gracefully leaves the ring."""
66+ # ...any state transfer logic (if using)...
5867 self ._ring.leave()
5968```
60- In future versions, we hope to support in-package state transfer.
69+ Not all distributed applications that ChordNet is suitable for will require
70+ state transfer logic (for example, search problems), and the nature of that
71+ logic will likely vary by app. In future versions, we hope to support
72+ in-library state transfer.
You can’t perform that action at this time.
0 commit comments