This commit is contained in:
33
src/storage/path_store.hpp
Normal file
33
src/storage/path_store.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace lm {
|
||||
|
||||
class Database;
|
||||
|
||||
class PathStore
|
||||
{
|
||||
public:
|
||||
explicit PathStore(Database& db);
|
||||
|
||||
nlohmann::json list(const std::string& site_id = "") const;
|
||||
std::optional<nlohmann::json> find(const std::string& id) const;
|
||||
std::optional<nlohmann::json> findBetween(const std::string& map_id,
|
||||
const std::string& from_position_id,
|
||||
const std::string& to_position_id) const;
|
||||
std::optional<nlohmann::json> upsert(const nlohmann::json& payload, std::string& err);
|
||||
bool remove(const std::string& id, std::string& err);
|
||||
int removeForMap(const std::string& map_id);
|
||||
int removeForPosition(const std::string& map_id, const std::string& position_id);
|
||||
|
||||
private:
|
||||
Database& db_;
|
||||
mutable std::mutex mu_;
|
||||
};
|
||||
|
||||
} // namespace lm
|
||||
Reference in New Issue
Block a user