Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
games_storage.h
1#ifndef CAVOKE_GAMES_STORAGE_H
2#define CAVOKE_GAMES_STORAGE_H
3
4#include <drogon/drogon.h>
5#include <boost/filesystem/path.hpp>
6#include <shared_mutex>
7#include <string>
8#include "game.h"
9#include "games_storage_config.h"
10namespace cavoke::server::model {
11
13public:
14 explicit GamesStorage(GamesStorageConfig config);
15
16 void update();
17
18 std::vector<Game> list_games();
19
20 std::optional<Game> get_game_by_id(const std::string &game_id);
21
22private:
23 GamesStorageConfig m_config;
24 std::map<std::string, Game> m_games;
25 std::shared_mutex m_games_mtx;
26};
27
28} // namespace cavoke::server::model
29
30#endif // CAVOKE_GAMES_STORAGE_H