From 5a28a331688c5578fef9c64d462d07cbae6797da Mon Sep 17 00:00:00 2001 From: "Tschaen, Brendan (bt054f)" Date: Tue, 26 Jun 2018 16:32:37 -0400 Subject: Add voting app example Change-Id: Ife1e6ea10cf74e3495ed72bc14a77179665ca327 Issue-ID: MUSIC-82 Signed-off-by: Tschaen, Brendan (bt054f) --- examples/VotingApp/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/VotingApp/README.md (limited to 'examples/VotingApp/README.md') diff --git a/examples/VotingApp/README.md b/examples/VotingApp/README.md new file mode 100644 index 00000000..bcd37b9b --- /dev/null +++ b/examples/VotingApp/README.md @@ -0,0 +1,31 @@ + +The voting app for MUSIC illustrates the features of MUSIC as a +multi-site state management +service. It is a program that +maintains state in MUSIC in the form of a vote-count table that has two columns, the candidateName +and his voteCount. To the external client that is using the voting app to update votes, the +votingApp provides a simple function to update the +votecount of the candidate in an exclusive manner. This is possible because of the locking service +in MUSIC. Since each candidate is a key in MUSIC, the votingapp simply acquires the geo-distributed +lock and only then upates the count. This guarantees correctness even when clients access different +end-points across data centers. Further since state is replicated correctly across data-centers, +even when one of the data centers fail, functioning can continue simply by using the MUSIC end point +in the other data center. + +The main function in the VotingApp.java is emulating clients from different data centers by randomly +chosing MUSIC end points. By updating vote counts +randomly using different MUSIC end points and still receiving the correct total count when doing a +read, the main function indicates the multi-site capability of MUSIC. + + +To run the application, make sure you have onboarded the application using music's admin api. +A curl call using the default values would be: +curl -X POST \ + http://localhost:8080/MUSIC/rest/v2/admin/onboardAppWithMusic \ + -H 'Content-Type: application/json' \ + -d '{ +"appname" : "votingapp", +"userId" : "abc123d", +"password" : "password", +"isAAF" : false +}' -- cgit 1.2.3-korg