In this assignment you will implement the Chandy-Lamport algorithm for distributed snapshots. Your snapshot algorithm will be implemented on top of a token passing system, similar to the ones presented in Precept 4 and in the Chandy-Lamport paper. The algorithm makes the following assumptions:
You will find the code for this assignment here. The code is organized as follows:
Of these files, you only need to turn in server.go and simulator.go. However, some other files also contain information that will be useful for your implementation or debugging, such as the debug flag in common.go and the thread-safe map in syncmap.go. Your task is to implement the functions that say TODO: IMPLEMENT ME, adding fields to the surrounding classes if necessary.
Our grading uses the tests in snapshot_test.go provided to you. Test cases can be found in test_data/. To test the correctness of your code, simply run the following command:
$ cd chandy-lamport/ $ go test Running test '2nodes.top', '2nodes-simple.events' Running test '2nodes.top', '2nodes-message.events' Running test '3nodes.top', '3nodes-simple.events' Running test '3nodes.top', '3nodes-bidirectional-messages.events' Running test '8nodes.top', '8nodes-sequential-snapshots.events' Running test '8nodes.top', '8nodes-concurrent-snapshots.events' Running test '10nodes.top', '10nodes.events' PASS ok _/path/to/chandy-lamport 0.012s
To run individual tests, you can look up the test names in snapshot_test.go and run:
$ go test -run 2Node Running test '2nodes.top', '2nodes-simple.events' Running test '2nodes.top', '2nodes-message.events' PASS ok chandy-lamport 0.006s
Submit your code to the dropbox for this assignment by 11:59pm 10/20 (Friday). You may submit multiple times, but only the one in the dropbox at the time of grading will be recorded. You should receive full credit as long as the tests pass within a reasonable amount of time (they usually take a small fraction of a second).
Last updated: 2017-10-17 14:59:24 -0400