Skip to content

Commit 56f4e1c

Browse files
committed
Add unregistration as future enhancement
1 parent 95ff2b9 commit 56f4e1c

7 files changed

Lines changed: 11 additions & 21 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"Shamir",
5959
"Shor's",
6060
"Starlette",
61+
"unregistration",
6162
"urandom",
6263
"Uvicorn",
6364
"venv"

TODO

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ TODO: Make sure key has unique key UUID
2020

2121
TODO: Key initiator: Select N peer hub (initially: all peer hubs)
2222

23-
TODO: Have client unregister itself from all hubs when it shuts down.
24-
The API call should use the DELETE method.
25-
Shutting down should not cause the client to unregister itself; make unregistration
26-
an explicit option.
27-
2823
TODO: Allow a client to register itself again (after a restart). Done; just need to test.
2924

3025
TODO: Add statistics management API and topology command to query it.

client/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def lifespan(_app: fastapi.FastAPI):
4747
"""
4848
_CLIENT.start_all_peer_hubs()
4949
yield
50-
# TODO: Unregister (attempt without retry or very limited)
50+
# We currently do not have any shutdown actions.
5151

5252

5353
_APP = fastapi.FastAPI(lifespan=lifespan)

client/client.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,6 @@ def start_all_peer_hubs(self) -> None:
124124
for peer_hub in self._peer_hubs:
125125
peer_hub.start_register_task()
126126

127-
async def unregister_from_all_peer_hubs(self) -> None:
128-
"""
129-
Unregister from all peer hubs.
130-
"""
131-
for peer_hub in self._peer_hubs:
132-
await peer_hub.unregister()
133-
134127
async def scatter_key_amongst_peer_hubs(self, key: UserKey) -> None:
135128
"""
136129
Split the key into key shares, and send each key share to a peer hub.

client/peer_hub.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ async def attempt_registration(self) -> bool:
148148
self._registered = True
149149
return True
150150

151-
async def unregister(self) -> None:
152-
"""
153-
Unregister this client from the peer hub.
154-
"""
155-
# TODO: Implement this and call it from somewhere
156-
157151
def start_request_psrd_task_if_needed(self) -> None:
158152
"""
159153
Start request PSRD task(s) if needed.

docs/protocol-guide.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,4 +1054,11 @@ been made including:
10541054

10551055
* The `POST` method for the `Get key with key IDs` interface is not supported.
10561056

1057-
* Error handling is not as robust as it should be.
1057+
* Error handling is not as robust as it should be.
1058+
1059+
### Unregistration
1060+
1061+
When a client starts, it registers itself with all hubs, using the PUT registration API.
1062+
Currently, client never unregister.
1063+
We can add an unregistration mechanism by adding a DELETE registration API and calling it
1064+
when a client shuts down orderly.

manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def stop_topology(self):
196196
"""
197197
Stop all nodes.
198198
"""
199-
# Stop the clients first, so that they can cleanly unregister from the hubs.
199+
# Stop the clients first, in case we implement unregistration at some point
200200
for node in self.selected_nodes(reverse_order=True):
201201
self.stop_node(node)
202202
self.wait_for_selected_nodes_stopped()

0 commit comments

Comments
 (0)