2#include <unordered_map>
5#include <spdlog/common.h>
21 std::unordered_map<wsConnPtr, MemberDataPtr> clients;
29 std::unordered_map<unsigned int, MemberDataPtr> clients_by_id;
36 void removeClient(std::unordered_map<wsConnPtr, MemberDataPtr>::iterator it,
37 std::unique_lock<std::mutex> &lock);
41 std::lock_guard lock(store_m);
45 std::lock_guard lock(store_m);
49 std::shared_ptr<std::unordered_map<unsigned int, int>>
ping_status;
56 : clients(), clients_by_id(), ping_status(), server(server),
57 keep_log(keep_log), hostname() {}
65 void newClient(
const wsConnPtr &con,
const std::string &remote_addr,
66 const spdlog::sink_ptr &sink,
67 spdlog::level::level_enum level);
68 void initClientId(
unsigned int id,
const wsConnPtr &con);
80 const std::function<
void()> &func_else =
nullptr);
85 void findAndDo(
unsigned int id,
87 const std::function<
void()> &func_else =
nullptr);
93 void findConnectedAndDo(
unsigned int id,
95 const std::function<
void()> &func_else =
nullptr);
102 void forEach(
const std::function<
void(
MemberDataPtr)> &func);
109 void forEachWithName(
const std::function<
void(
MemberDataPtr)> &func);
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:69
auto clientsCopy()
Definition store.h:40
std::shared_ptr< std::unordered_map< unsigned int, int > > ping_status
Definition store.h:49
Server * server
Definition store.h:50
~ServerStorage()
Definition store.h:58
int keep_log
Definition store.h:52
std::string hostname
Definition store.h:53
auto clientsByIdCopy()
Definition store.h:44
ServerStorage(Server *server, int keep_log=1000)
Definition store.h:55
void * wsConnPtr
Definition server.h:21
std::shared_ptr< MemberData > MemberDataPtr
Definition store.h:12
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103