acl/lib_acl_cpp/include/acl_cpp/hsocket/hspool.hpp

61 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "../stdlib/noncopyable.hpp"
2014-11-19 00:25:21 +08:00
#include <list>
#ifndef ACL_CLIENT_ONLY
2014-11-19 00:25:21 +08:00
struct ACL_HTABLE;
namespace acl {
class hsclient;
class locker;
class ACL_CPP_API hspool : public noncopyable
2014-11-19 00:25:21 +08:00
{
public:
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param addr_rw {const char*} handlersocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mysql <EFBFBD>ϵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD> handlersocket <EFBFBD>Ķ<EFBFBD>д<EFBFBD><EFBFBD>ַ
* @param addr_rd {const char*} handlersocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mysql <EFBFBD>ϵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD> handlersocket <EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
* @param cache_enable {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD>󻺴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param retry_enable {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
hspool(const char* addr_rw, const char* addr_rd = NULL,
bool cache_enable = true, bool retry_enable = true);
~hspool();
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
* @param dbn {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param tbl {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param idx {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
* @param flds {const char*} Ҫ<EFBFBD>򿪵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD>ʽΪ
* <EFBFBD>ɷָ<EFBFBD><EFBFBD><EFBFBD> ",; \t" <EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD>user_id,user_name,user_mail
* @param readonly {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
hsclient* peek(const char* dbn, const char* tbl,
const char* idx, const char* flds, bool readonly = false);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* @param client {hsclient*}
*/
void put(hsclient* client);
private:
char* addr_rw_;
char* addr_rd_;
bool cache_enable_;
bool retry_enable_;
std::list<hsclient*> pool_;
locker* locker_;
};
} // namespace acl
#endif // ACL_CLIENT_ONLY