Filling up AnalyticsService
This commit is contained in:
1 parent
521e988b3a
commit
533a5c8f4a
2 files changed
+40
-3
No files matched your search
@@ -1,15 +1,43 @@
|
||||
#include "AnalyticsServiceServer.h"
|
||||
#include "lib/logging/logging.h"
|
||||
#include "lib/persistence/SqliteStore.h"
|
||||
#include "lib/utils/PBUtils.h"
|
||||
#include "lib/utils/Puid.h"
|
||||
#include <string>
|
||||
|
||||
namespace bts::analytics {
|
||||
|
||||
struct AnalyticsServiceServer::PImpl {};
|
||||
struct AnalyticsServiceServer::PImpl {
|
||||
bts::api::ServiceContext &context;
|
||||
std::unique_ptr<persistence::IStore> vs_fill_store;
|
||||
AnalyticsServiceBase::VolsurfacesStatefulPublisher vs_publisher;
|
||||
PImpl(
|
||||
bts::api::ServiceContext &context,
|
||||
const AnalyticsServiceBase::VolsurfacesStatefulPublisher &vs_publisher)
|
||||
: context(context),
|
||||
vs_fill_store(
|
||||
std::make_unique<persistence::SqliteStore>("volsurfaces")),
|
||||
vs_publisher(vs_publisher) {}
|
||||
};
|
||||
|
||||
AnalyticsServiceServer::AnalyticsServiceServer(
|
||||
bts::api::ServiceContext &context)
|
||||
: AnalyticsServiceBase(context) {}
|
||||
: AnalyticsServiceBase(context),
|
||||
me(new PImpl(context, make_volsurfaces_stateful_publisher())) {
|
||||
auto all = me->vs_fill_store->retrieve_all();
|
||||
LOG(persist, Info, "Finished loading all {} manual fills", all.size());
|
||||
for (auto const &ns_vals : all) {
|
||||
const std::string &vs_name = ns_vals.first;
|
||||
const std::map<std::string, std::string> &vals = ns_vals.second;
|
||||
LOG(OrderMan, Info, "vs:{} entries:{}", vs_name, vals.size());
|
||||
for (const auto &kvp : vals) {
|
||||
const std::string &key = kvp.first;
|
||||
const std::string &val = kvp.second;
|
||||
LOG(OrderMan, Info, "vs:{} key:{} val:{}", vs_name, key, val);
|
||||
}
|
||||
}
|
||||
me->vs_publisher.flush();
|
||||
}
|
||||
|
||||
void AnalyticsServiceServer::get_new_volsurface_id(
|
||||
const ::bts::api::VoidMessage &,
|
||||
@@ -18,7 +46,11 @@ void AnalyticsServiceServer::get_new_volsurface_id(
|
||||
|
||||
void AnalyticsServiceServer::save_volsurface(
|
||||
const ::bts::api::analytics::VolSurfaceEntry &,
|
||||
const api::Response<::bts::api::ResultMessage> &) {}
|
||||
const api::Response<::bts::api::ResultMessage> &) {
|
||||
// ns = vs_key_name
|
||||
// key = posix save time
|
||||
// val = VolSurfaceEntry
|
||||
}
|
||||
|
||||
void AnalyticsServiceServer::delete_volsurface(
|
||||
const ::bts::api::analytics::IntWrapper &,
|
||||
|
||||
Reference in new issue
Block a user