6 #include "knowrob/Logger.h"
7 #include "knowrob/storage/mongo/QueryWatch.h"
8 #include "knowrob/storage/mongo/MongoException.h"
9 #include "knowrob/reasoner/mongolog/bson_pl.h"
30 std::lock_guard<std::mutex> guard(
lock_);
38 std::lock_guard<std::mutex> guard(
lock_);
48 const std::shared_ptr<Collection> &collection,
54 std::lock_guard<std::mutex> guard(
lock_);
55 watcher_map_.emplace(next_id, std::make_unique<ChangeStream>(collection, query, callback));
65 std::lock_guard<std::mutex> guard(
lock_);
78 std::lock_guard<std::mutex> guard(
lock_);
84 KB_WARN(
"exception in mongo watch: {}", exc.what());
90 std::this_thread::sleep_until(next);
void unwatch(long watcher_id)
static std::atomic< long > id_counter_
long watch(const std::shared_ptr< Collection > &collection, const bson_t *query, const ChangeStreamCallback &callback)
std::map< long, std::unique_ptr< ChangeStream > > watcher_map_
std::function< void(const bson_wrapper_ptr &)> ChangeStreamCallback