aboutsummaryrefslogtreecommitdiff
path: root/statsd/stats.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'statsd/stats.hpp')
-rw-r--r--statsd/stats.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/statsd/stats.hpp b/statsd/stats.hpp
new file mode 100644
index 0000000..673022e
--- /dev/null
+++ b/statsd/stats.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "server.hpp"
+#include "receiver.hpp"
+
+#include "cmix.pb.h"
+
+#include <boost/asio/io_service.hpp>
+
+#include <list>
+
+class Stats {
+ boost::asio::io_service io_service;
+ Server server;
+ std::list<Receiver> connections;
+
+ typedef std::vector<uint64_t> Column;
+ typedef std::map<std::string, Column> Table;
+ typedef std::map<std::string, Table> Tables;
+
+ Tables data;
+
+ void accept_connection(std::unique_ptr<boost::asio::ip::tcp::socket>&& socket);
+
+ void handle_performance(std::list<Receiver>::iterator it, cmix_proto::Performance const& perf);
+
+ void handle_message(std::list<Receiver>::iterator it, cmix_proto::CMixMessage message);
+
+public:
+ Stats(ListenSettings lsettings);
+
+ void run();
+}; \ No newline at end of file