At MySQL I'm writing several different command-line applications from the MEMo Agent to the MySQL Proxy. They all have a common set of requirement:
- command-line options
- config-files (mapping cmd-line options to config-files)
- logfile handling (syslog, SIGHUP, ...)
- a mainloop (SIGINT, CtrlHandler, ...)
- daemonizing (daemonize, services, ...)
- plugin handling
In the proxy svn you see all this a the
chassis of the proxy.
At the side it has a MySQL-Server and a MySQL-Client (we usually call it the proxy). Currently this is implemented as libmysql-proxy which is then used by the proxy plugin to implement the proxy.
By splitting up the design into 3 different layers:
- low-level protocol + protocol states
- proxy implementation as plugin
- use the chassis for any kind of application
- implement MySQL apps based indepenent of the proxy features
- implement plugins for the chassis which don't use MySQL
For most of the chassis I used functionality provided already by glib2:
- GOption + GKeyFile
- the log facilities
as we don't want to invent another platform independent API.
For the future I plan to clean up the second layer a bit and perhaps write a load generator that:
- can handle more than 100 connections
- and is scripted
We already have all the parts for it.
BTW, this is 0.7.0 aka trunk. The 0.6.1 is already built, but is stuck because of problems on win32.