wsproxy/server/wsproxy/upstreammgr.h
2023-04-09 07:35:24 +00:00

26 lines
538 B
C++

#pragma once
#include <a8/singleton.h>
class UpStream;
class UpStreamMgr : public a8::Singleton<UpStreamMgr>
{
private:
UpStreamMgr() {};
friend class a8::Singleton<UpStreamMgr>;
public:
void Init();
void UnInit();
UpStream* GetConnByKey(const std::string& key);
UpStream* GetConnById(int instance_id);
UpStream* RecreateUpStream(const std::string& host, int port);
private:
unsigned short curr_id_ = 1000;
std::map<std::string, UpStream*> key_hash_;
std::map<int, UpStream*> id_hash_;
};