A rudimentary example of a distributed in-memory key-value store (with lots of bugs)
In one terminal:
ruby server.rb 4001
In another terminal:
telnet localhost 4001
And use the protocol in spec.txt
, e.g. PUT foo bar
and then GET foo
.
You can then start another server in a third terminal:
ruby server.rb 4002
And using the open telnet session, you can execute ADD_NODE localhost 4002
.
Then you can connect to the new node with telnet localhost 4002
and run GET foo
there and it'll work.
That's probably everything that will work 😄