00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #include "config.h"
00025
00026 #include <scalestack/database_proxy/service.h>
00027 #include <scalestack/kernel/core.h>
00028 #include <scalestack/kernel/module.h>
00029
00030 using namespace std;
00031 using namespace scalestack;
00032
00033 static void options(kernel::module& current)
00034 {
00035 network::ip::tcp::listener_service::options(current, ":7");
00036 current.add_option("client_address", "Host:port to proxy to.", "HOST", "127.0.0.1:12345");
00037 current.add_option("max_clients", "Maxiumum number of clients to use.",
00038 "MAX", "1");
00039 }
00040
00041 static void start(kernel::module& current)
00042 {
00043 database_proxy::service* service = new database_proxy::service(current);
00044 try
00045 {
00046 current.get_core().add_service("database_proxy", service);
00047 }
00048 catch (exception&)
00049 {
00050 delete service;
00051 throw;
00052 }
00053 }
00054
00055 static void stop(kernel::module& current)
00056 {
00057 delete current.get_core().remove_service("database_proxy");
00058 }
00059
00060 SCALESTACK_KERNEL_MODULE(options, start, stop, NULL, NULL);