larryhastings / drafty

MIT License
0 stars 0 forks source link

Add a Command to partition the network #2

Open ericvsmith opened 1 year ago

ericvsmith commented 1 year ago

Something along the lines of "partition 0 1 4", which limits the servers you can read from and write to.

So if there are 5 servers, then running "partition 0 1 4" and those servers, and "partition 2 3" on 2 and 3 will partition the network. Add an "unpartition" command to reset to the normal state.

You must include your own server id in the partition command. This will serve as a check: all servers in the partition will run the same command.

ericvsmith commented 1 year ago

One problem is that since there's not a 1 to 1 mapping of servers to IP addresses, we can't drop messages solely based on their network source. Remember that while testing, all servers are running on the same IP address (localhost).

So for incoming messages we've got to read the message, look at the sender server_id, then decide to drop the message. I think this is okay, and since it's the best we can do, it will have to suffice.

larryhastings commented 1 year ago

Well, naturally. It's a debugging / testing facility after all. I don't mind that it's white-box testing.