Versioned File Server
#Installation 1.Download a copy using: git clone https://github.com/imran91/CS733.git
2.Change directory to : cd $GOPATH/src/github.com/imran91/CS733/Assignment1
3.Run the test script using : go test
#Command Specification
-
Write: create a file, or update the file’s contents if it already exists.
write <filename> <numbytes> [<exptime>]\r\n
<content bytes>\r\nThe server responds with the following:
OK <version>\r\n -
Read: Given a filename, retrieve the corresponding file:
read <filename>\r\nThe server responds with the following format (or one of the errors described later)
CONTENTS <version> <numbytes> <exptime> \r\n
<content bytes>\r\n -
Compare and swap. This replaces the old file contents with the new content provided the version is still the same.
cas <filename> <version> <numbytes> [<exptime>]\r\n
<content bytes>\r\nThe server responds with the new version if successful
OK <version>\r\n -
Delete file
delete <filename>\r\nThe server response (if successful)
OK\r\n
#Errors
- ERR_VERSION <newversion>\r\n (the contents were not updated because of a version mismatch. The latest version is returned)
- ERR_FILE_NOT_FOUND\r\n (the filename doesn’t exist)
- ERR_CMD_ERR\r\n (the command is not formatted correctly)
- ERR_INTERNAL\r\n (remaining errors)