Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store information about which servers are in the cluster in the log, …
…rather than in a registry. This means either starting the cluster the first time WITH registrant log statements already IN the log OR Registering all the servers you want in the cluster before one of them times out.
- Loading branch information
1 parent
65c39e1
commit 4fed5b4
Showing
5 changed files
with
61 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from src.server import Server | ||
|
||
|
||
Server(name=str("Kermit"), port=int(10010)).start() | ||
Server(name=str("MsPiggy"), port=int(10011)).start() | ||
Server(name=str("Gonzo"), port=int(10012)).start() | ||
Server(name=str("Beaker"), port=int(10013)).start() | ||
Server(name=str("Fozzie"), port=int(10014)).start() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1 @@ | ||
import ast | ||
|
||
from src.config import server_nodes, destination_addresses | ||
|
||
def return_address_and_message(string_request): | ||
address_with_message = string_request.split("@") | ||
return address_with_message[0], "@".join(address_with_message[1:]) | ||
|
||
|
||
def broadcast(server, message): | ||
print("Broadcasting " + message) | ||
for other_server_address in destination_addresses(server.name): | ||
server.send(message, to_server_address=other_server_address) | ||
|
||
def with_return_address(server, response): | ||
return server.name + "@" + response | ||
|
||
|
||
def address_of(server_name): | ||
return server_nodes()[server_name] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters