Skip to content

Commit d563681

Browse files
committed
project arrangement
1 parent c287443 commit d563681

40 files changed

+233
-76
lines changed

acl_cpp_vc2008.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 10.00
22
# Visual Studio 2008
3-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{4FE55739-6D3E-4FA7-BC10-05AB84E3D721}"
3+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "acl_cpp_samples", "acl_cpp_samples", "{4FE55739-6D3E-4FA7-BC10-05AB84E3D721}"
44
EndProject
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "aio", "aio", "{B8331BFA-4F66-41B8-9A0F-8B7617DC07B8}"
66
EndProject

acl_cpp_vc2010.sln

+2
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "redis_cluster2_vc2010", "li
279279
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
280280
EndProjectSection
281281
EndProject
282+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples_acl", "samples_acl", "{6E9E519A-6E4F-491A-91C0-6CA079CA0C94}"
283+
EndProject
282284
Global
283285
GlobalSection(SolutionConfigurationPlatforms) = preSolution
284286
Debug|Win32 = Debug|Win32

acl_cpp_vc2012.sln

-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zdb", "lib_acl\samples\zdb\
261261
EndProject
262262
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples_acl", "samples_acl", "{267F658E-44AF-4080-8577-EFCE99A5E030}"
263263
EndProject
264-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples_protocol", "samples_protocol", "{7C54A0C9-3817-4BBC-BF52-4FA941FD3C69}"
265-
EndProject
266264
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cgi", "lib_acl_cpp\samples\cgi\cgi_vc2012.vcxproj", "{2C2212C1-01D2-4C8E-AB15-F7E31C7C134B}"
267265
EndProject
268266
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aio_server_ssl", "lib_acl_cpp\samples\aio\aio_server_ssl\aio_server_ssl_vc2012.vcxproj", "{A07145B7-36AE-4D6F-8536-30A8BE48529D}"

lib_acl_cpp/include/acl_cpp/redis/redis.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
namespace acl
1717
{
1818

19+
/**
20+
* 该类继承了所有 redis 命令类,因此可以只通过此类对象使用所有的 redis 命令。
21+
* inherit all the redis command class, which include all the commands
22+
* of Key, String, Hash, List, Set, SortedSet, Hyperloglog, Pub/Sub,
23+
* Transaction, Script, Connection, Server.
24+
*/
1925
class ACL_CPP_API redis
2026
: public redis_connection
2127
, public redis_hash

lib_acl_cpp/include/acl_cpp/redis/redis_client.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ class dbuf_pool;
1212
class redis_result;
1313
class redis_request;
1414

15+
/**
16+
* redis 客户端对象网络通信类,通过此类将组织好的 redis 请求命令发给 redis 服务端,
17+
* 同时接收 redis 服务端响应结果;该类继承于 connect_client 类,主要为了使用连接池
18+
* 功能。
19+
* redis client network IO class. The redis request is sent to server
20+
* and the server's respond is handled in this class. The class inherits
21+
* connect_client, which can use the connection pool function.
22+
*/
1523
class ACL_CPP_API redis_client : public connect_client
1624
{
1725
public:

lib_acl_cpp/include/acl_cpp/redis/redis_cluster.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ namespace acl
99

1010
class redis_pool;
1111

12+
/**
13+
* redis 客户端集群类,通过将此类对象注册入 redis 客户端命令类(redis_command),
14+
* 则使所有的客户端命令自动支持集群版 redis 命令。
15+
* redis client cluster class. The class's object is set in the redis_command
16+
* using redis_command::set_cluster(redis_cluster*), and all the redis client
17+
* command will support the redis cluster mode.
18+
*/
1219
class ACL_CPP_API redis_cluster : public connect_manager
1320
{
1421
public:

lib_acl_cpp/include/acl_cpp/redis/redis_command.hpp

+29-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,34 @@ class redis_request;
1919
class ACL_CPP_API redis_command
2020
{
2121
public:
22+
/**
23+
* 缺省的构造函数,如果使用此构造函数初始化类对象,则必须调用 set_client 或
24+
* set_cluster 设置 redis 客户端命令类对象的通讯方式。
25+
* default constructor. You must set the communication method by
26+
* set_client or set_cluster functions.
27+
*/
2228
redis_command();
29+
30+
/**
31+
* 当使用非集群模式时的构造函数,可以使用此构造函数设置 redis 通信类对象。
32+
* Using this constructor to set the redis communication mode,
33+
* usually in no-cluster mode.
34+
* @param conn {redis_client*} redis 通信类对象
35+
* the redis communication in no-cluster mode
36+
*/
2337
redis_command(redis_client* conn);
38+
39+
/**
40+
* 使用集群模式的构造函数,在构造类对象时指定了集群模式的 redis_cluster 对象。
41+
* Using this constructor to set the redis_cluster, usually in
42+
* cluster mode.
43+
* @param cluster {redis_cluster*} redis 集群连接对象
44+
* redis cluster object in cluster mode
45+
* @param max_conns {size_t} 与集群中所有结点之间的每个连接池的最大连接数
46+
* the max of every connection pool with all the redis nodes
47+
*/
2448
redis_command(redis_cluster* cluster, size_t max_conns);
49+
2550
virtual ~redis_command() = 0;
2651

2752
/**
@@ -39,9 +64,9 @@ class ACL_CPP_API redis_command
3964
void reset(bool save_slot = false);
4065

4166
/**
42-
* 在使用连接池方式时,通过本函数将从连接池获得的连接对象;
43-
* when using connection pool and not in cluster mode, the function
44-
* is used to set the connection for next redis command operation.
67+
* 在使用非集群方式时,通过本函数将从连接池获得的连接对象;
68+
* when not using cluster mode, the function is used
69+
* to set the connection for next redis command operation.
4570
* @param conn {redis_client*} 与 redis 客户端命令进行关联;
4671
* the redis connection to be set in next redis operation
4772
*/
@@ -232,6 +257,7 @@ class ACL_CPP_API redis_command
232257
const redis_result** scan_keys(const char* cmd, const char* key,
233258
int& cursor, size_t& size, const char* pattern,
234259
const size_t* count);
260+
235261
/*******************************************************************/
236262

237263
void build(const char* cmd, const char* key,

lib_acl_cpp/include/acl_cpp/redis/redis_connection.hpp

+26
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,72 @@ class redis_client;
1010
/**
1111
* redis Connection 类,包含命令如下:
1212
* AUTH、ECHO、PING、QUIT、SELECT
13+
* redis connection command clss, including as below:
14+
* AUTH, ECHO, PING, QUIT, SELECT
1315
*/
1416
class ACL_CPP_API redis_connection : virtual public redis_command
1517
{
1618
public:
19+
/**
20+
* see redis_command::redis_command()
21+
*/
1722
redis_connection();
23+
24+
/**
25+
* see redis_command::redis_command(redis_client*)
26+
*/
1827
redis_connection(redis_client* conn);
28+
29+
/**
30+
* see redis_command::redis_command(redis_cluster*, size_t)
31+
*/
1932
redis_connection(redis_cluster* cluster, size_t max_conns);
33+
2034
virtual ~redis_connection();
2135

2236
/////////////////////////////////////////////////////////////////////
2337

2438
/**
2539
* 连接至 redis-server 时进行身份验证
40+
* AUTH command to login the redis server.
2641
* @param passwd {const char*} 在 redis 配置文件中指定的认证密码
42+
* the password in redis-server configure
2743
* @return {bool} 身份认证是否成功,返回 false 表示认证失败或操作失败
44+
* return true if success, or false because auth failed or error.
2845
*/
2946
bool auth(const char* passwd);
3047

3148
/**
3249
* 选择 redis-server 中的数据库 ID
50+
* SELECT command to select the DB id in redis-server
3351
* @param dbnum {int} redis 数据库 ID
52+
* the DB id
3453
* @return {bool} 操作是否成功
54+
* return true if success, or false for failed.
3555
*/
3656
bool select(int dbnum);
3757

3858
/**
3959
* 探测 redis 连接是否正常
60+
* PING command for testing if the connection is OK
4061
* @return {bool} 连接是否正常
62+
* return true if success
4163
*/
4264
bool ping();
4365

4466
/**
4567
* 测试用命令,让 redis-server 回显给定字符串
68+
* ECHO command, request redis-server to echo something.
4669
* @return {bool} 操作是否成功
70+
* return true if success
4771
*/
4872
bool echo(const char* s);
4973

5074
/**
5175
* 关闭 redis 连接
76+
* QUIT command to close the redis connection
5277
* @return {bool}
78+
* return true if success
5379
*/
5480
bool quit();
5581
};

lib_acl_cpp/include/acl_cpp/redis/redis_hash.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@ class redis_result;
1919
class ACL_CPP_API redis_hash : virtual public redis_command
2020
{
2121
public:
22+
/**
23+
* see redis_command::redis_command()
24+
*/
2225
redis_hash();
26+
27+
/**
28+
* see redis_command::redis_command(redis_client*)
29+
*/
2330
redis_hash(redis_client* conn);
31+
32+
/**
33+
* see redis_command::redis_command(redis_cluster*, size_t)
34+
*/
2435
redis_hash(redis_cluster* cluster, size_t max_conns);
36+
2537
virtual ~redis_hash();
2638

2739
/////////////////////////////////////////////////////////////////////

lib_acl_cpp/include/acl_cpp/redis/redis_hyperloglog.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@ class redis_client;
1212
class ACL_CPP_API redis_hyperloglog : virtual public redis_command
1313
{
1414
public:
15+
/**
16+
* see redis_command::redis_command()
17+
*/
1518
redis_hyperloglog();
19+
20+
/**
21+
* see redis_command::redis_command(redis_client*)
22+
*/
1623
redis_hyperloglog(redis_client* conn);
24+
25+
/**
26+
* see redis_command::redis_command(redis_cluster*, size_t)
27+
*/
1728
redis_hyperloglog(redis_cluster* cluster, size_t max_conns);
29+
1830
virtual ~redis_hyperloglog();
1931

2032
/**

lib_acl_cpp/include/acl_cpp/redis/redis_key.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ typedef enum
2323
class ACL_CPP_API redis_key : virtual public redis_command
2424
{
2525
public:
26+
/**
27+
* see redis_command::redis_command()
28+
*/
2629
redis_key();
30+
31+
/**
32+
* see redis_command::redis_command(redis_client*)
33+
*/
2734
redis_key(redis_client* conn);
35+
36+
/**
37+
* see redis_command::redis_command(redis_cluster*, size_t)
38+
*/
2839
redis_key(redis_cluster* cluster, size_t max_conns);
40+
2941
virtual ~redis_key();
3042

3143
/**

lib_acl_cpp/include/acl_cpp/redis/redis_list.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@ class redis_client;
1010
class ACL_CPP_API redis_list : virtual public redis_command
1111
{
1212
public:
13+
/**
14+
* see redis_command::redis_command()
15+
*/
1316
redis_list();
17+
18+
/**
19+
* see redis_command::redis_command(redis_client*)
20+
*/
1421
redis_list(redis_client* conn);
22+
23+
/**
24+
* see redis_command::redis_command(redis_cluster*, size_t)
25+
*/
1526
redis_list(redis_cluster* cluster, size_t max_conns);
27+
1628
virtual ~redis_list();
1729

1830
/////////////////////////////////////////////////////////////////////

lib_acl_cpp/include/acl_cpp/redis/redis_pool.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
namespace acl
66
{
77

8+
/**
9+
* redis 连接池类,该类继承于 connect_pool,在 connect_pool 定义了通用的有关
10+
* TCP 连接池的通用方法。
11+
* redis connection pool inherting from connect_pool, which includes
12+
* TCP connection pool methods.
13+
*/
814
class ACL_CPP_API redis_pool : public connect_pool
915
{
1016
public:
@@ -15,6 +21,7 @@ class ACL_CPP_API redis_pool : public connect_pool
1521
* @param idx {size_t} 该连接池对象在集合中的下标位置(从 0 开始)
1622
*/
1723
redis_pool(const char* addr, int count, size_t idx = 0);
24+
1825
virtual ~redis_pool();
1926

2027
/**

lib_acl_cpp/include/acl_cpp/redis/redis_pubsub.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ class string;
1414
class ACL_CPP_API redis_pubsub : virtual public redis_command
1515
{
1616
public:
17+
/**
18+
* see redis_command::redis_command()
19+
*/
1720
redis_pubsub();
21+
22+
/**
23+
* see redis_command::redis_command(redis_client*)
24+
*/
1825
redis_pubsub(redis_client* conn);
26+
27+
/**
28+
* see redis_command::redis_command(redis_cluster*, size_t)
29+
*/
1930
redis_pubsub(redis_cluster* cluster, size_t max_conns);
31+
2032
virtual ~redis_pubsub();
2133

2234
/////////////////////////////////////////////////////////////////////

lib_acl_cpp/include/acl_cpp/redis/redis_result.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class string;
2020
class dbuf_pool;
2121
class redis_client;
2222

23+
/**
24+
* 对 redis-server 返回结果对象类,对 redis-server 返回的数据进行分析后创建
25+
* redis_result 类对象。
26+
* the redis result for redis-server's respond
27+
*/
2328
class ACL_CPP_API redis_result
2429
{
2530
public:

lib_acl_cpp/include/acl_cpp/redis/redis_script.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@ class redis_result;
1313
class ACL_CPP_API redis_script : virtual public redis_command
1414
{
1515
public:
16+
/**
17+
* see redis_command::redis_command()
18+
*/
1619
redis_script();
20+
21+
/**
22+
* see redis_command::redis_command(redis_client*)
23+
*/
1724
redis_script(redis_client* conn);
25+
26+
/**
27+
* see redis_command::redis_command(redis_cluster*£¬ size_t)
28+
*/
1829
redis_script(redis_cluster* cluster, size_t max_conns);
30+
1931
virtual ~redis_script();
2032

2133
/////////////////////////////////////////////////////////////////////

lib_acl_cpp/include/acl_cpp/redis/redis_server.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@ class redis_result;
1313
class ACL_CPP_API redis_server : virtual public redis_command
1414
{
1515
public:
16+
/**
17+
* see redis_command::redis_command()
18+
*/
1619
redis_server();
20+
21+
/**
22+
* see redis_command::redis_command(redis_client*)
23+
*/
1724
redis_server(redis_client* conn);
25+
26+
/**
27+
* see redis_command::redis_command(redis_cluster*, size_t)
28+
*/
1829
redis_server(redis_cluster* cluster, size_t max_conns);
30+
1931
virtual ~redis_server();
2032

2133
/////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)