CS 4513 Distributed Computing Systems WPI, D Term 2001
Craig E. Wills Project 3 (35 pts)
Assigned: Tuesday, April 18, 2001 Due: Monday, April 30, 2001

Important: This project is to be done by each student on an individual basis. There is no group work on this project.

Introduction

The overall goal of this project is to build a distributed file system using Sun RPC of Java RMI for distributed communication between the client and the server. Your file server will serve directory and file contents of the underlying Unix/Linux file system. You will not build on the file system modifications you created for the last project and will not need to modify the kernel for this project. You may use either the CCC or Fossil Lab facilities for this project.

Problem

Distributed file systems allow local clients to access files and directories on remote servers. As discussed in class there are many issues in building a distributed file system and many approaches that can be taken to address these issues. For this project you will be building a distributed file system client and server. These processes will communicate using either Sun RPC or Java RMI. The client will handle file system operations requests made by a user, translate them to appropriate remote procedure calls and print the result of each request. The initial current working directory for the server should be the Unix/Linux directory from which the server is started.

Operations

The project sets forth a number operations that users will make using a command line interface. Each operation will translate into one or more RPC (or RMI) calls. The following defines the set of directory and file operations that your client/server must support. The suggested RPC (or RMI) function call(s) for each operation are also shown in the form:

output_type function_name(input_type)

Directory Operations

All directory operations are with respect to the current directory (``.'') unless the directory_name begins with a ``/'' in which case a full path is specified. You need to implement the following directory operations:

Sequential Access File Operations

Your program should support two file operations that access a local and remote file in sequential manner:

Random Access File Operation

Your program should support one file operation that allows random portions of a remote text file to be read:

Example

Your client program must have at least one command line argument, the name of the remote machine to contact for the file server. If the next argument is the ``-f filename'' switch then your client program should read in commands from a file. If the ``-f'' option is absent, then the commands are to be read from standard input. You should provide the user with a command prompt, but only if input is from standard input. An example set of operations and appropriate responses are given below. In general each operation must print a single line response message (except for ls and ls -l as shown below). The basic response line must begin ``operation [succeeded|failed]'' with additional explanation optional.


% client serverhost
$ getdir
getdir succeeded with /users/csfaculty/cew
$ ls
./
../
foo/
letter.tex
prog1.c
$ filecount
filecount succeeded with count of 5
$ ls -l
./                        512 Mon Apr  9 21:12:29 EDT 2001
../                      4096 Mon Apr  9 21:12:29 EDT 2001
foo/                      512 Mon Apr  9 21:14:48 EDT 2001
letter.tex               2935 Mon Apr  9 21:16:01 EDT 2001
prog1.c                  1170 Mon Apr  9 21:15:11 EDT 2001
$ cd foo
cd succeeded
$ getdir
getdir succeeded with /users/csfaculty/cew/foo
$ ls -l
./                        512 Mon Apr  9 21:15:29 EDT 2001
../                      4096 Mon Apr  9 21:15:29 EDT 2001
$ cd bar
cd failed
$ cd ..
cd succeeded
$ get prog1.c localprog1.c
get succeeded transferring 1170 bytes
$ get prog2.c localprog2.c
get failed prog2.c not found
$ randomread letter.tex 1 14
randomread succeeded transferring 14 bytes
\documentclass$

Each input line contains one operation with any needed parameters separated by spaces. Again, your program must given the operation name and ``succeeded'' or ``failed'' after each operation other than for ls and ls -l. The format of any output after the success or failure indication is up to you, but it must be on a single line. The order of your output for the ls operations may differ from the example. Note that the output from the randomread operation may not terminate with a newline character. This result will cause the prompt to be printed on the same line as the output as shown in the example.

Your Task

The name of your client executable should be client and the name of your server executable should be server. It is suggested that your proceed in the following manner for this project:

1.
Concentrate on the directory operations first. As a starting point to ensure that you understand how to access the underlying directory information, you should create a single program that implements the directory operations using the suggested function calls. This program should not use RPC or RMI. A correctly working program that implements the directory operations is worth 12 points on the project.

2.
Once this program is working, break it in two so that you have a client and server program. You will need to to use Sun RPC or Java RMI for the client stub functions to call the appropriate server stubs. Correctly working client and server programs that implement the directory operations are worth 21 points on the project.
3.
Next implement the two sequential access file operations. Correct implementation of these two operations in your client/server architecture are worth 27 points on the project.

4.
Next implement the random access file operation. Correct implementation of it is worth 30 points on the project.

5.
For the final five points of the project, you will need to implement a caching mechanism for the get and put operations. For these commands, you should keep track of the local and remote file being transferred. You also need to store the last modified time of these files after the operation (modify closefile to return the last modified time of the remote file). If a subsequent request with the same local and remote file occurs then you must first validate the last modified time of the local and remote file. You will need to introduce a validate operation to validate the last modified time of a remote file. If the local and remote files are unchanged then your program should report operation success as in the following example.

$ get prog1.c localprog1.c
get succeeded transferring 1170 bytes
$ get prog1.c localprog1.c
get succeeded files unchanged

Submission

Use the turnin program to submit your project with the name ``proj3''. Turn in your program files, makefile (if any) and script files showing runs for the sample file; do not turn in any executable files. Indicate in header comments of your code what portions of the project you attempted and completed.