For this project, you will develop a content delivery network (CDN) to deliver books on behalf of your booksite. Your server will maintain a list of all registered mirror sites and will redirect users to an appropriate mirror for download. The CDN will be responsible for replicating new content at all mirror sites. New mirrors may join at any time, and existing mirrors may leave at any time. Your program will build a tree of nodes and deliver content appropriately.
The Main Site
The main server will provide all of the functionality described in Project 1, with the following additions:
Mirror Sites
The mirror sites are responsible for the following:
This functionality is achieved by implementing the following interface. Your mirrors should all implement the same interface and should be able to interoperate.
Supported By | URI | Method | Response | Description |
Main | /admin/register?ip={addr}&port={port} | GET | 204 No Content/409 Conflict | Register a new mirror site with IP address addr listening at port port. The server must maintain a database of all mirror sites. Status 204 is returned if the register was successful. Status 409 is returned if the client cannot be registered (e.g., it is already registered). |
Main | /admin/unregister?ip={addr}&port={port} | GET | 204 No Content/409 Conflict | Unregister an existing mirror site with IP address addr listening at port port. Note that a mirror may unregister a mirror other than itself, for example if it discovers that its parent mirror has failed. Status 204 is returned if the unregister was successful. Status 409 is returned if the client cannot be unregistered (e.g., if it is not registered). |
Main and Mirror | /admin/children | GET | 200 OK
<ResultList> <Child ip="addr" port="port"/> <Child ip="addr" port="port"/> </ResultList> |
Retrieve a list of all a node's children. |
Main and Mirror | /admin/refresh | GET | 204 No Content | A response to a refresh request indicates to the requester that the responder has not failed. Status 204 is returned if the server receives the message. |
Main and Mirror | /admin/join?ip={addr}&port={port} | GET | 204 No Content/409 Conflict | Join as new child of the server with IP address addr listening at port port. Status 204 is returned if the join was successful. Status 409 is returned if the new child cannot be added (e.g., the child list of the server is already full). |
Main | /admin/content?timestamp={num} | GET | 200 OK
Content of zip file |
Retrieve the content with timestamp num. The main server is responsible for maintaining all back content and serving it to clients when requested. |
Mirror | /admin/content?timestamp={num} | POST | 204 No Content/409 Conflict. | Send content with timestamp num to child server. |
Main | /admin/ack?ip={addr}&port={port}×tamp={num} | GET | 204 No Content/409 Conflict | An acknowledgement that the client with IP addr listening at port port has received message with timestamp num. |
Note: No portion of your code may be copied from any other source
including another text book, a web page, or another student (current or
former). You must provide citations for any sources you have used in
designing and implementing your program.