Skip to content

Commit

Permalink
reslove filepaths with dynamic replication
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchay0 committed Nov 6, 2017
1 parent c354a44 commit dc87118
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion failure_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func nodeLeave() {
func handleUserInput() {
for {
fmt.Println("Please enter FD commands: \n\"1) list\"\n \"2) neighbor\"\n \"3) id\"\n \"4) join\"\n \"5) leave\"")
fmt.Printf("Or enter SDFS commands: \n\"1) filemap\"\n \"2) isMaster\"\n \"3) put\"\n \"4) get\"\n \"5) delete\"\n \"6) store\"\n \"7) ls\"\n \"8) replicas\"\n> ")
fmt.Printf("Or enter SDFS commands: \n\"1) filemap\"\n \"2) isMaster\"\n \"3) put\"\n \"4) get\"\n \"5) delete\"\n \"6) store\"\n \"7) ls\"\n \"8) replicas\"\n \"9) updateMap\"\n> ")
// var input string
scanner := bufio.NewReader(os.Stdin)
input, _ := scanner.ReadString('\n')
Expand All @@ -258,6 +258,8 @@ func handleUserInput() {
isMaster() //comes from sdfs.go
case "replicas\n":
showReplicas() //comes from sdfs.go
case "updateMap\n":
showUpdateMap()
default:
s := strings.Split(input, " ")
if(strings.HasPrefix(input, "put")) {
Expand Down
6 changes: 6 additions & 0 deletions sdfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,3 +580,9 @@ func electReplication(replica int, replicationNumber int) {
func showReplicas() {
fmt.Printf("%d replicas are %d and %d\n", vmID, replica1, replica2)
}

func showUpdateMap() {
for k, v := range updateMap {
fmt.Println("%s %12d\n", k, convertTime(v).Format(time.UnixDate))
}
}

0 comments on commit dc87118

Please sign in to comment.