Menu

server-connection

Roger B. Dannenberg Rajeev Sharma Afnan Fahim

Home

Server-Side Connection Manager

A web server will be used to support the federation configuration. Each participant’s program will use HTTP to register a federation, role, name, orchestra, and IP address.
1. federation is the name of the whole group in case there is more than one independent concert going on (or testing), e.g. “sleo”
2. role is either super-node or node
3. name is an individual’s identifier, e.g. John
4. orchestra is an orchestra name, e.g. CMU or Colorado
5. IP address is implicit in the HTTP message, the IP address of the laptop
The web server will keep a list of federations. Each federation will have a list of orchestras. Each orchestra will have a designated super-node and a set of nodes, each with a name and IP address. Nodes will try to register by sending information, and if a super-node exists, the IP address of the super-node will be returned. When a super-node registers, the IP addresses of all other super-nodes will be returned so the super-node can connect to them.

The server should also return elapsed time from the first registration. This will be used to estimate the global federation time. See clock synchronization.

The server should also implement some pages accessible through browsers to get the full status of federations, and also to delete federations that are finished.

The server should also implement a way to initialize a federation performance, e.g. clear all previous registrations. (There should be at least some modest security to prevent a random mean-spirited person from clicking the reset button. One possibility is no web interface -- just authenticate to AFS and delete a file.)

The conductor has special status, and (in our implementation), there should only be one conductor. Thus, the conductor should register with the server so that others can discover the conductor, the conductor's super-node, and so that only one node is allowed to become the conductor. Coordinate with the conducting interface group, the chat system group and maybe others to integrate this functionality into the system.

Design

Based on my (RBD) reverse-engineering of the Connection code, here are some notes on the design and how to use the server:

Call getOrchestraId(orchName), invoking URL "orchestra" to get an integer.
If the result is -1, create the orchestra with createOrchestra(), invoking URL "orchestra".
Before creating an orchestra, call getFederationId(), invoking URL "federation" to get an integer. If the result is -1, create the federation with createFederation(), invoking URL "federation".

Once the existence of the orchestra is established, use URL "register" to register the node with name, orchestra, federation, supernode (yes/no), and conductor (yes/no).

The response contains nodes and/or supernodes...

If you are a node, you need to connect to your supernode. The supernode ip, if it exists, appears in the response: Look for the string "Your supernode:" in some response line. In the following line, split the line into fields separated by blanks and take the 3rd field, numbered from 1 through N, (the supernode name, e.g. "/cmu/rbd") and the 4th field (the supernode ip).

If there is no supernode, you should wait for the supernode to connect to you.

Java Implementation

An implementation has been completed in Python and hosted on Google's App Engine. The functionality is exactly the same as that of the Python implementation, and the workings of the GET requests on which the implementation is based are presented in the Python implementation below. The implementation is accessable at http://laptop-orchestra.appspot.com/*.

Python Implementation

An implementation has been completed in Python. Functionality is provided via GET requests. It is available at http://www.music.cs.cmu.edu/cgi-bin/*. Files marked with an asterisk are password-protected. If you look at the code it should be pretty easy to tell how to get pass the password. The functionality and required parameters are as follows:

admin(*)

  • Arguments: (none)
  • Web interface for controlling server. Should not be used for any other purpose; hook into other files.

conductor

  • Arguments: (none)
  • If the IP of the requester belongs to a registered user, returns information about the conductor and the conductor's supernode.
  • If the requester is not registered, returns an error.

federation

  • Arguments: action, name
  • 'list' action: list the currently registered federations. 'name' argument not required with this action.
  • 'check' action: checks if a federation already exists with the specified name, If found, the returned code will contain "Yes, number: n", where n is an integer.
  • 'create' action: creates a federation with the specified name. Returns an error if it already exists.
  • 'delete' action: deletes the federation with the specified name.

info

  • Arguments: (none)
  • If the requester is a supernode, returns a list of the other supernodes with both IP addresses and names.
  • If the requester is not a supernode, returns the IP and name supernode of the requestor's orchestra, or a message indicating the absence of a supernode.
  • If the requester is not registered, returns an error.

init(*)

  • Arguments: (none)
  • Initializes the database. If the database already exists, all data is destroyed.

kick

  • Arguments: ip
  • If requester is a supernode, unregisters the user with the specified IP address.
  • If requester is not a supernode, returns an error.

lib.py

  • Arguments: (none)
  • This is a library file used by other files in the folder. Calling this will do nothing.

orchestra

  • Arguments: action, name, federation
  • 'list' action: list all current orchestras. Name and federation arguments not required.
  • 'check' action: check if an orchestra already exists with the specified name. If found, the returned code will contain "Yes, number: n", where n is an integer.
  • 'create' action: create an orchestra with the specified name. If the orchestra already exists, return an error.
  • 'delete' action: delete the orchestra with the specified name.

register

  • Arguments: name, orchestra, supernode, conductor
  • Registers the requester's IP
  • Name is a string, orchestra is the integer ID of the orchestra to register in, supernode is a boolean to determine if the user should be registered as a supernode, conductor is a boolean to determine if the user should be registered as a conductor
  • Returns an error if the requested name is already taken or if the IP address is already registered.

reset(*)

  • Arguments: (none)
  • Deletes all data currently in the databases.

unregister

  • Arguments: (none)
  • Deletes the user corresponding to the requester from the database. To unregister an arbitrary user, see kick.py.

usercheck

  • Arguments: type, ip, name
  • 'ip' type: check if a user with the specified IP address is registered.
  • 'name' type: check if a user with the specified name is registered.

Implementation Plan

  • Python group: Rajeev Sharma (rdsharma), Andrew Israel (abi)
    • Use Python CGI on AFS
    • SQLite for database
    • Rajeev: Database schema, front-end, documentation
    • Andrew: Back-end, integration
  • Java group: Scott Bertiaux (sebertia), Afnan Fahim
    (afahim)
    • Use Java Servlets on Google App Engine
    • Cloud SQL for database
    • Afnan: Database, Back-end, consistency with Python implementation

Home


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.