Technical description of the racnucd daemon

Program racnucd (full source code) manages all remote access to ACNUC databases. It is a daemon process that forks a child process for each remote client that opens a socket connection. The 3 actors, daemon, child process, and remote client, and programs that temporarily disable databases for updates, communicate through socket, signals and pipes as follows:

        _________________________________________________________________________________________
       |                                                                                         |
       |          configuration                                                                  |      
       |              file                                                                       |    
       |                                                                                         | 
       |             daemon    <--------------  db management programs                           |         
       |                         disable_pipe                                                    |  
       |             ^   |                                                                       | 
       |             |   |                                                                       | 
       |    open_pipe|   |signal                                                                 | 
       |             |   |SIGUSR2                                                                |        
       |             |   |                                                                       |                    
       |             |  \/                                                                       | 
       |                           socket (default = pbil.univ-lyon1.fr:5558)                    |       
       |             child        <==========================================>     remote client |
       |_________________________________________________________________________________________|

daemon: Deamon uses a series of configuration parameters: port, maxtime, known_db_file, db_env_names, disable_pipe, username, log. The first argument given at daemon startup names the configuration file.

signals:Signal SIGUSR2 is sent to child by daemon when the database currently served by this child to its remote client has just been temporarily closed for update; the child writes "acnuc stop for update\n" on socket and exits.

open_pipe: a pipe from child to daemon. Child writes "acnucopen dbname pid\n" or "acnucclose dbname pid\n" on it to inform daemon of what child serves what database (dbname is the database name, pid is the child's).

configuration file: is read by daemon at startup; is structured such as this:
port=5558
maxtime=50000
known_db_file=/www/data/banques_raa
db_env_names=/www/data/banques_acnuc
disable_pipe=racnucd_disable.fifo

parameter disable_pipe: a named pipe, writable by the db management user, named by disable_pipe configuration parameter. A database management program that intends to update a database writes on it "disable dbname\n" or "enable dbname\n" to inform daemon that a given database becomes temporarily closed, or is back on line. Daemon then sends SIGUSR2 to any child serving this database.

parameter known_db_file: names the file that lists the name and availability of databases that the daemon offers to serve. An example file is:

# db_name | current status | tag | description
#         |   on / off     |     | free text
embl      | on             |     | EMBL sequence data library
swissprot | off            |     | SwissProt + TREMBL  
nbrf      | on             |  *  | NBRF                       | ab04959e4a4686142c92427216a57dc6  
emblTP    | on             | TP  | frozen EMBL release  
Each db_name is a logical name for a database; see parameter db_env_names.
Tag field usage: Any of these databases can be opened by the acnucopen&db=db_name command.
Changes in this file are immediately accessible to the server.

parameter db_env_names: names the file that gives values to database names listed in known_db_file, following the csh syntax. The values express where are located index and flat files of the corresponding databases. Changes in this file are immediately accessible to the server. An example file is:

#file defining the location of all acnuc databases
setenv embl '/banques1/embl/index /banques3/embl/flat_files'
setenv genbank '/banques0/genbank/index /banques0/genbank/flat_files' 
setenv swissprot '/banques3/swissprot/index /banques3/swissprot/flat_files' 

parameter port: sets the port used for socket communication.

parameter maxtime: time limit for lack of communication between client and child. If child did not receive any command from its client since maxtime seconds, child exits.

parameter username: if the server is run from the root account, it will change its username to the given one.

parameter log: the standard output and error of the server and its children will go to this file.

db_management programs: use the utility program raadbstatus to send disable/enable information to daemon, or to password-protect a database.