Skip to content

Added setup for download file demo #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed _download/test2.txt
Empty file.
5 changes: 3 additions & 2 deletions chord/daemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func CheckPredecessorDaemon(chordNode *ChordNode) {
// transfer keys from the predecessor that have ID higher than
// predecessor's ID
err = chordNode.stubTransferKeys(ipAddr(pred.Ip), ctx, pred.Id, chordNode.node)

log.WithField("err", err).Info("check predecessor daemon failed")
if err != nil {
log.WithField("err", err).Info("check predecessor daemon failed")
}
}
2 changes: 0 additions & 2 deletions chord/fileSharingServerImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ func (chordNode *ChordNode) TransferFile(fileInfo *FileInfo, stream FileShareSer
if !fileExist(filePath) {
fmt.Println(fmt.Sprintf("File [%v] does not exist", filePath))
return nil // Do not stop the server
} else {
fmt.Println(fmt.Sprintf("File [%v] does exist", filePath))
}

file, err := os.Open(filePath)
Expand Down
27 changes: 27 additions & 0 deletions tests/demo_downloadFile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash


# Test the FileSharing service and client interaction
cd ..

go build

# Removed current file1.txt for fair results
rm _download/file1.txt

xterm -title "Node A " -hold -e "./CS438_Project -name A -ipAddr=127.0.0.1:5000 -create -m 8" &
xterm -title "Node B " -hold -e "./CS438_Project -name B -ipAddr=127.0.0.1:10001 -join -existingNodeIp 127.0.0.1:5000 -existingNodeId db -m 8" &
xterm -title "Node C " -hold -e "./CS438_Project -name C -ipAddr=127.0.0.1:10002 -join -existingNodeIp 127.0.0.1:5000 -existingNodeId db -m 8 -v" &
xterm -title "Node D " -hold -e "./CS438_Project -name D -ipAddr=127.0.0.1:10003 -join -existingNodeIp 127.0.0.1:5000 -existingNodeId db -m 8" &
xterm -title "Node E " -hold -e "./CS438_Project -name E -ipAddr=127.0.0.1:10004 -join -existingNodeIp 127.0.0.1:5000 -existingNodeId db -m 8" &

sleep 15
cd client
go build
./client -PeersterAddress=127.0.0.1:10004 -command=download -file=file1.txt -nameToStore=file1.txt -ID="db"
cd ..
echo "Diference between uploaded and downloaded:"
diff _upload/file1.txt _download/file1.txt

# Go back to tests
cd tests