#include <CAVERNdb_c.hxx>
Inheritance diagram for CAVERNdb_client_c::
Public Methods | |
CAVERNdb_client_c () | |
~CAVERNdb_client_c () | |
int | init (char *serverIP, int serverPort=CAVERNdb_server_c::DEFAULT_TCP_REFLECTOR_PORT, char *defaultDBName=CAVERNDB_CLIENT_DEFAULT_DB_NAME, int udp_reflector_port=CAVERNdb_server_c::DEFAULT_UDP_REFLECTOR_PORT) |
int | fetch (char *pathname, char *keyname) |
void | trigger (void(*callback)(char *pathname, char *keyname, void *userData), void *userData) |
int | put (char *pathname, char *keyname, char *data, int datasize, int typeOfConnection=CAVERNdb_client_c::RELIABLE_CONNECTION) |
char* | get (char *pathname, char *keyname, int *datasize) |
int | process () |
int | reconnect (char *servername=NULL, int port=0) |
int | commit (char *pathname, char *keyname) |
int | remoteCommit (char *pathname, char *keyname) |
char* | getNotifyPathname () |
char* | getNotifyKeyname () |
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 Attributes | |
const int | FAILED |
Status failed. | |
const int | OK |
Status ok. | |
const int | MEM_ALLOC_ERR |
Memory allocation error. | |
const int | CONNECTION_TERMINATED |
Connection terminated. | |
const int | IGNORED |
Action ignored. See reconnect(). | |
const int | UNRELIABLE_CONNECTION |
Use unreliable UDP for data transmission (make sure the datasize is less than 1K). | |
const int | RELIABLE_CONNECTION |
Use reliable TCP for data transmission. | |
const int | MAX_UDP_PACKET_SIZE |
Maximum udp packet size allowed (1 KB). | |
Private Methods | |
void | handleMessage (char *data, int dataSize) |
void | handleIncomingPut (char *data, int datasize) |
Private Attributes | |
char* | notifyPathname |
char* | notifyKeyname |
keyToolManager_c* | keyToolManager |
CAVERNnet_tcpReflectorClient_c* | client |
CAVERNnet_udp_c* | udpClient |
void* | callbackUserData |
void (* | triggerCallback )(char *pathname, char *keyname, void *userData) |
char | itsServerName [256] |
int | itsServerPort |
int | udpReflectorPort |
CAVERNts_mutex_c* | clientmutex |
CAVERNts_mutex_c * | callbackmutex |
|
Commit data in local database.
|
|
Properly delete the perfDaemonClient after sendStats is done |
|
Fetch data from server. This is a non-blocking call so once the fetch command has been issued it will return. It is then up to the server to respond eventually.
|
|
Get data in a key.
|
|
Get the keyname of the key that has triggered a notify event. This is mainly used by observers that have attached to this object. |
|
Get the pathname of the key that has triggered a notify event. This is mainly used by observers that have attached to this object. |
|
Initialize client by connecting to remote server. If you specify serverIP as NULL then you are making no network connections. Ie you are using the client database in local single user mode.
|
|
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.
|
|
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.
|
|
Process the client. Do this as frequently as possible and in a while loop.
|
|
Put data into a key. The users can also make use of a UDP connection for the data transmission by using CAVERNdb_client_c::UNRELIABLE_CONNECTION (the default is a reliable tcp connection). Please note that the datasize for UDP should be less than 1K. If the datasize is more than 1K, the data is sent via a TCP connection
|
|
Reconnect to server on broken connection. If the result of process() call is CONNECTION_TERMINATED you can try to reconnect to the server.
|
|
Commit data in server database.
|
|
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)
|
|
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)
|
|
Set a trigger so that when data arrives it will fire a callback. Callbacks are fired after notification of observers.
|
|
Clientmutex is used to try and prevent multiple threads from using the socket at the same time or using the keytool database. Callbackmutex is used to make sure multiple callbacks do not fire at the same time since there is no guarantee that the user will write a thread-safe callback function. |
|
Clientmutex is used to try and prevent multiple threads from using the socket at the same time or using the keytool database. Callbackmutex is used to make sure multiple callbacks do not fire at the same time since there is no guarantee that the user will write a thread-safe callback function. |