Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 6

Robert Judka
CS550
Programming Assignment 1
Manual
Requirements
This system was developed in C++11 and compiled with the g++ compiler and a Linux subsystem.
Running this will not work on a Windows (possibly not MacOS either) subsystem as it does not have the
required directory interface.
Build
In src/, running
make all
will generate the indexing_server and peer executables. It will also create the peer directories used in
this manual and the log directory where the system logs could be found (this may fail if you are not
within the ‘src/’ directory).
Execute
To start the indexing server, run
./indexing_server
To start a peer, in a separate terminal run
./peer {path_to_your_directory}
Demo
For convenience, 3 peer directories were prepopulated with files. You can run these 3 peers (in 3
separate terminates) with ‘peers/p1’, ‘peers/p2’, and ‘peers/p3’ as their directories. NOTE these
directories will only exist if using the build procedure from above and stay within the ‘src/’ direcotry.
This will the state of your system after executing the indexing_server and 3 peers:
To see a list of all registered files, a hidden request ‘l’ could be made through a peer. Here we can see
the contents of the files_index on the indexing server:
Here we can see all the files registered to the 3 peers, and the files which are shared among the peers.
Now, to search for a specific file in the network, we enter ‘s’ for ‘searchinto the command line and then
enter the file we want to search for. In this example, we search for ‘r.txt’:
Looking at the first screenshot, we can see that ‘r.txt’ is owned by both the middle peer [client id 37965]
and the bottom peer [client id 41703].
Next, to download a file, we can choose one of the client ids we just learned and the file to download
into our directory (assuming we are the top peer [client id 43231]). To do this, we first enter ‘r’ for
‘retrieve’ into the command line, then the peer number (in our example we entered ‘37965’), and finally
the file to download, ‘r.txt’:
We see we have gotten the message saying ‘r.txt’ was successfully downloaded and attempted to
display the file (‘. . .’ symbolizes the content of the file). We can also see on the right side in the terminal
pointing to our directory, that by running the ‘ls’ command, ‘r.txt’ is now within our directory.
We can also see, by entering ‘l’ again into the command line, that the files_index has been updated to
include our new file ‘r.txt’:
In the indexing server, we can see our client id (assuming we are the top peer [client id 43231]) was
added as an owner of ‘r.txt’.
Now say we don’t want the file ‘f.txt’ in our directory anymore. After running the ‘rm f.txt’ command on
the right side in the terminal pointing to our directory, and entering ‘l’ again into the command line, that
files_index no longer contains our file ‘f.txt’:
Here, we can see that ‘f.txt’ no longer exists in our directory and that change was updated in the
files_index in the indexing server.
To check that other peers also function properly, we will move to the middle peer [client id 37965], and
enter ‘s’ into the command line to search for the file ‘r.txt’:
We see again that ‘r.txt’ is owner by all 3 peers.
Finally, we want to remove the middle peer [client id 37965] and the bottom peer [client id 41703] by
entering ‘q’ for quit into both of their command lines. Then, to verify both those peers were removed
from the network, we enter ‘l’ into the command line for the top peer [client id 43231]:
In the indexing server, we can see that the only files in the files_index are those which are owned by the
top peer [client id 43231].
*more detailed outputs can be viewed in the ‘logs/’ directory

Navigation menu