Commit ea50f34c authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Do dump announced groups to font-end's `/groups.txt`.

As plain text, one per line, undefined ordering.
parent 15f6cda1
......@@ -514,6 +514,10 @@ struct Client::Impl {
return *_newest_proto_seen;
}
std::set<std::string> get_announced_groups() const {
return _dht_groups->groups();
}
void set_log_level(log_level_t l) {
cerr << "Setting cache/client Cache log level to " << l << "\n";
_log_level = l;
......@@ -608,6 +612,11 @@ unsigned Client::get_newest_proto_version() const
return _impl->get_newest_proto_version();
}
std::set<std::string> Client::get_announced_groups() const
{
return _impl->get_announced_groups();
}
void Client::set_log_level(log_level_t l)
{
_impl->set_log_level(l);
......
......@@ -7,6 +7,7 @@
#include "cache_entry.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <set>
namespace ouinet {
......@@ -59,6 +60,10 @@ public:
// (e.g. to warn about potential upgrades).
unsigned get_newest_proto_version() const;
// Get all groups being announced to the distributed cache index
// by this client.
std::set<std::string> get_announced_groups() const;
~Client();
void set_log_level(log_level_t);
......
......@@ -182,11 +182,15 @@ static void load_log_file(stringstream& out_ss) {
void ClientFrontEnd::handle_group_list( const Request&
, Response& res
, std::stringstream& ss)
, std::stringstream& ss
, cache::Client* cache_client)
{
res.set(http::field::content_type, "text/plain");
ss << "TODO\n";
if (!cache_client) return;
for (const auto& g : cache_client->get_announced_groups())
ss << g << std::endl;
}
void ClientFrontEnd::handle_portal( ClientConfig& config
......@@ -463,7 +467,7 @@ Response ClientFrontEnd::serve( ClientConfig& config
res.set(http::field::content_type, "text/plain");
load_log_file(ss);
} else if (path == group_list_apath) {
handle_group_list(req, res, ss);
handle_group_list(req, res, ss, cache_client);
} else if (path == "/api/status") {
sys::error_code e;
handle_status( config, udp_port, upnps, reachability
......
......@@ -102,7 +102,8 @@ private:
void handle_group_list( const Request&
, Response&
, std::stringstream&);
, std::stringstream&
, cache::Client*);
void handle_portal( ClientConfig&
, const Request&
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment