Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAVERNdb_server_c Class Reference

#include <CAVERNdb_c.hxx>

List of all members.

Public Methods

 ~CAVERNdb_server_c ()
int init (char *defaultDBName=CAVERNDB_SERVER_DEFAULT_DB_NAME, int incomingPort=CAVERNdb_server_c::DEFAULT_TCP_REFLECTOR_PORT, int maxClients=CAVERNdb_server_c::DEFAULT_MAX_CLIENTS, int udpReflectorPort=CAVERNdb_server_c::DEFAULT_UDP_REFLECTOR_PORT)
int process ()
void showStats (char *streamInfo, char *comment)
int logStats (char *streamInfo, char *comment, FILE *filePtr)
int sendStats (char *streamInfo, char *comment)
int initSendStats (char *monitorClientIP, int port=PERF_DAEMON_DEFAULT_PORT)
void exitSendStats ()

Static Public Methods

void newConnectionHandler (CAVERNnet_tcpReflectorClient_c *newClient, void *userData)
int newDataHandler (CAVERNnet_tcpReflectorClient_c *client, char **buffer, int *bufferSize, void *userData)
int udpDataHandler (CAVERNnet_udp_c *udpClient, char **buffer, int *bufferSize, void *userData)

Static Public Attributes

const char PUT_MESG
const char FETCH_MESG
const char COMMIT_MESG
const int DEFAULT_TCP_REFLECTOR_PORT
 Default listening port for the TCP Reflector of the DB Server(for reliable connections).

const int DEFAULT_UDP_REFLECTOR_PORT
 Default listening port for the UDP Reflector of the DB Server.

const int DEFAULT_MAX_CLIENTS
 Default maximum number of clients that the server can manage.

const int OK
 Status ok.

const int FAILED
 Status failed.

const int MEM_ALLOC_ERR
 Memory allocation error.

const int TOO_MANY_CLIENTS
 Server cannot manage any more clients.


Private Methods

void handlePut (char *buf, int size)
void handleFetch (CAVERNnet_tcpReflectorClient_c *client, char *buf, int size)
void handleCommit (CAVERNnet_tcpReflectorClient_c *client, char *buf, int size)
void sendPutMessage (CAVERNnet_tcpReflectorClient_c *client, char *pathname, int pathsize, char *keyname, int keysize)

Private Attributes

CAVERNnet_tcpReflector_cserver
CAVERNnet_udpReflector_cudpreflector
keyToolManager_c* keyToolManager
int incomingPort


Detailed Description

CAVERN database server. This server will listen for incoming connections and field database requests from CAVERNdb_client_c connections. This database is designed mainly to handle small datasets- primarily state information. To retrieve larger datasets consider using the CAVERNnet_remoteFileIO_c calls which are designed to move in excess of 2Gig data files.


Member Function Documentation

void CAVERNdb_server_c::exitSendStats ( )
 

Properly delete the perfDaemonClient after sendStats is done

int CAVERNdb_server_c::init ( char * defaultDBName = CAVERNDB_SERVER_DEFAULT_DB_NAME,
int incomingPort = CAVERNdb_server_c::DEFAULT_TCP_REFLECTOR_PORT,
int maxClients = CAVERNdb_server_c::DEFAULT_MAX_CLIENTS,
int udpReflectorPort = CAVERNdb_server_c::DEFAULT_UDP_REFLECTOR_PORT )
 

Initialize server.

Parameters:
defaultDBName   database directory name. Default name is CAVERNdbserver.
incomingPort   db server's (tcp reflector's) listening port. Default port 9500.
maxClients   maximum number of clients that may connect to the server. Default is 64 clients.
udpReflectorPort   udp reflector listening port. Default port is 9550

Returns:
MEM_ALLOC_ERR, FAILED or OK.

int CAVERNdb_server_c::initSendStats ( char * monitorClientIP,
int port = PERF_DAEMON_DEFAULT_PORT )
 

Initialize sendStats - provide the IP of the perfDaemon and an optional port number to connect to. This should be done initially before using the sendStats API.

Parameters:
monitorClientIP   IP address of the perfDameon to connect to
port   Port number at which the perfDaemon is running -this is optional. The default port number for perfDaemon is 9500 -so a different port number has to be specified if the perfDaemon is running on a different port.

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

int CAVERNdb_server_c::logStats ( char * streamInfo,
char * comment,
FILE * filePtr )
 

This logs performance statistics in a file. The user opens a file and passes the file pointer with this function and results of monitoring are written into the logfile.

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored
filePtr   File pointer to the file in which the results of monitoring are to be stored

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

int CAVERNdb_server_c::process ( )
 

Handle connections and process incoming requests. Do this in a while loop as frequently as possible to ensure that requests are processed rapidly.

Returns:
OK, FAILED, TOO_MANY_CLIENTS

int CAVERNdb_server_c::sendStats ( char * streamInfo,
char * comment )
 

Sends the performance statistics to a remote perfdaemon -for further analysis of the monitored data - the initSendStats API should be called first, before calling a sendStats (In order to connect to the perfdaemon initially)

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

void CAVERNdb_server_c::showStats ( char * streamInfo,
char * comment )
 

Displays the resultant statistics instantaneously in the netlogger format - this should be typically done after a read/write is done a network.

Also, it should be noted that a showStats call should be made at the end of atleast one send and receive for two-way information (the same applies for logStats and sendStats)

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored


The documentation for this class was generated from the following file:
Generated at Mon Jul 2 14:24:43 2001 for CAVERNsoft by doxygen1.2.8-20010617 written by Dimitri van Heesch, © 1997-2001