Skip to content

Commit 8de5748

Browse files
committed
change: move http redis mysql to their own folder
1 parent 8fcac42 commit 8de5748

22 files changed

+52
-53
lines changed

BUILD

+18-21
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package(default_visibility = ["//visibility:public"])
22

33
cc_library(
44
name = "detail_hdrs",
5-
hdrs = glob(["include/coke/detail/*"])
5+
hdrs = glob(["include/coke/detail/*.h"])
66
)
77

88
cc_library(
99
name = "compatible_hdrs",
10-
hdrs = glob(["include/coke/compatible/*"])
10+
hdrs = glob(["include/coke/compatible/*.h"])
1111
)
1212

1313
cc_library(
@@ -34,7 +34,6 @@ cc_library(
3434
],
3535
hdrs = [
3636
"include/coke/basic_awaiter.h",
37-
"include/coke/basic_server.h",
3837
"include/coke/coke.h",
3938
"include/coke/condition.h",
4039
"include/coke/dag.h",
@@ -46,7 +45,6 @@ cc_library(
4645
"include/coke/latch.h",
4746
"include/coke/make_task.h",
4847
"include/coke/mutex.h",
49-
"include/coke/network.h",
5048
"include/coke/qps_pool.h",
5149
"include/coke/queue_common.h",
5250
"include/coke/queue.h",
@@ -67,19 +65,25 @@ cc_library(
6765
]
6866
)
6967

68+
cc_library(
69+
name = "net",
70+
srcs = [],
71+
hdrs = glob(["include/coke/net/*.h"]),
72+
includes = ["include"],
73+
deps = [
74+
"//:common",
75+
],
76+
)
77+
7078
cc_library(
7179
name = "http",
7280
srcs = [
7381
"src/http_impl.cpp"
7482
],
75-
hdrs = [
76-
"include/coke/http_client.h",
77-
"include/coke/http_server.h",
78-
"include/coke/http_utils.h",
79-
],
83+
hdrs = glob(["include/coke/http/*.h"]),
8084
includes = ["include"],
8185
deps = [
82-
"//:common",
86+
"//:net",
8387
"@workflow//:http",
8488
],
8589
)
@@ -89,14 +93,10 @@ cc_library(
8993
srcs = [
9094
"src/redis_impl.cpp"
9195
],
92-
hdrs = [
93-
"include/coke/redis_client.h",
94-
"include/coke/redis_server.h",
95-
"include/coke/redis_utils.h",
96-
],
96+
hdrs = glob(["include/coke/redis/*.h"]),
9797
includes = ["include"],
9898
deps = [
99-
"//:common",
99+
"//:net",
100100
"@workflow//:redis",
101101
],
102102
)
@@ -106,13 +106,10 @@ cc_library(
106106
srcs = [
107107
"src/mysql_impl.cpp"
108108
],
109-
hdrs = [
110-
"include/coke/mysql_client.h",
111-
"include/coke/mysql_utils.h",
112-
],
109+
hdrs = glob(["include/coke/mysql/*.h"]),
113110
includes = ["include"],
114111
deps = [
115-
"//:common",
112+
"//:net",
116113
"@workflow//:mysql",
117114
],
118115
)

example/ex002-http_get.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <iostream>
22
#include <string>
33

4-
#include "coke/coke.h"
5-
#include "coke/http_client.h"
6-
#include "coke/http_utils.h"
4+
#include "coke/wait.h"
5+
#include "coke/http/http_client.h"
6+
#include "coke/http/http_utils.h"
77

88
/**
99
* This example uses coke::HttpClient to send an Http Get request

example/ex003-http_hello_server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <string>
33
#include <cerrno>
44

5-
#include "coke/coke.h"
6-
#include "coke/http_server.h"
5+
#include "coke/task.h"
6+
#include "coke/http/http_server.h"
77

88
/**
99
* This example start an http server on port 8888, the server replies a simple

example/ex006-http_proxy.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <string>
44

55
#include "coke/global.h"
6-
#include "coke/http_server.h"
7-
#include "coke/http_client.h"
6+
#include "coke/http/http_server.h"
7+
#include "coke/http/http_client.h"
88
#include "workflow/URIParser.h"
99

1010
coke::HttpClientParams cli_params {

example/ex007-redis_cli.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include <cstring>
77
#include <cmath>
88

9-
#include "coke/coke.h"
9+
#include "coke/wait.h"
1010
#include "coke/tools/option_parser.h"
11-
#include "coke/redis_client.h"
12-
#include "coke/redis_utils.h"
11+
#include "coke/redis/redis_client.h"
12+
#include "coke/redis/redis_utils.h"
1313
#include "readline_helper.h"
1414

1515
std::string prompt_str;

example/ex008-parallel_http_get.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include <string>
33
#include <vector>
44

5-
#include "coke/coke.h"
6-
#include "coke/http_client.h"
7-
#include "coke/http_utils.h"
5+
#include "coke/wait.h"
6+
#include "coke/http/http_client.h"
7+
#include "coke/http/http_utils.h"
88

99
/**
1010
* This example send multiple http requests, waits for the results

example/ex009-mysql_cli.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
#include <string>
44
#include <vector>
55

6-
#include "coke/coke.h"
6+
#include "coke/wait.h"
7+
#include "coke/go.h"
78
#include "coke/tools/option_parser.h"
8-
#include "coke/mysql_client.h"
9-
#include "coke/mysql_utils.h"
9+
#include "coke/mysql/mysql_client.h"
10+
#include "coke/mysql/mysql_utils.h"
1011

1112
#include "readline_helper.h"
1213

example/ex011-redis_server.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
#include <cctype>
77
#include <shared_mutex>
88

9-
#include "coke/coke.h"
10-
#include "coke/redis_server.h"
9+
#include "coke/task.h"
10+
#include "coke/sleep.h"
11+
#include "coke/redis/redis_server.h"
1112

1213
/**
1314
* This example start a redis server on port 8379, shows how to use

include/coke/http_client.h include/coke/http/http_client.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <utility>
2424
#include <string>
2525

26-
#include "coke/network.h"
26+
#include "coke/net/network.h"
2727

2828
#include "workflow/HttpMessage.h"
2929

include/coke/http_server.h include/coke/http/http_server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef COKE_HTTP_SERVER_H
2020
#define COKE_HTTP_SERVER_H
2121

22-
#include "coke/basic_server.h"
22+
#include "coke/net/basic_server.h"
2323

2424
#include "workflow/WFHttpServer.h"
2525
#include "workflow/HttpMessage.h"
File renamed without changes.

include/coke/mysql_client.h include/coke/mysql/mysql_client.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <string>
2323

24-
#include "coke/network.h"
24+
#include "coke/net/network.h"
2525

2626
#include "workflow/MySQLMessage.h"
2727
#include "workflow/URIParser.h"
File renamed without changes.

include/coke/basic_server.h include/coke/net/basic_server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define COKE_BASIC_SERVER_H
2121

2222
#include "coke/task.h"
23-
#include "coke/network.h"
23+
#include "coke/net/network.h"
2424
#include "workflow/WFServer.h"
2525

2626
namespace coke {
File renamed without changes.

include/coke/redis_client.h include/coke/redis/redis_client.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <utility>
2424
#include <string>
2525

26-
#include "coke/network.h"
26+
#include "coke/net/network.h"
2727

2828
#include "workflow/RedisMessage.h"
2929
#include "workflow/URIParser.h"

include/coke/redis_server.h include/coke/redis/redis_server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef COKE_REDIS_SERVER_H
2020
#define COKE_REDIS_SERVER_H
2121

22-
#include "coke/basic_server.h"
22+
#include "coke/net/basic_server.h"
2323

2424
#include "workflow/WFRedisServer.h"
2525
#include "workflow/RedisMessage.h"
File renamed without changes.

src/http_impl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <strings.h>
2323
#include <openssl/evp.h>
2424

25-
#include "coke/http_client.h"
26-
#include "coke/http_utils.h"
25+
#include "coke/http/http_client.h"
26+
#include "coke/http/http_utils.h"
2727

2828
#include "workflow/WFTaskFactory.h"
2929

src/mysql_impl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <mutex>
2121
#include <queue>
2222

23-
#include "coke/mysql_client.h"
24-
#include "coke/mysql_utils.h"
23+
#include "coke/mysql/mysql_client.h"
24+
#include "coke/mysql/mysql_utils.h"
2525

2626
#include "workflow/StringUtil.h"
2727
#include "workflow/WFTaskFactory.h"

src/redis_impl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <string>
2020
#include <cctype>
2121

22-
#include "coke/redis_client.h"
23-
#include "coke/redis_utils.h"
22+
#include "coke/redis/redis_client.h"
23+
#include "coke/redis/redis_utils.h"
2424

2525
#include "workflow/WFTaskFactory.h"
2626
#include "workflow/StringUtil.h"

test/test_http.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <gtest/gtest.h>
2121

2222
#include "coke/coke.h"
23-
#include "coke/http_client.h"
24-
#include "coke/http_server.h"
23+
#include "coke/http/http_client.h"
24+
#include "coke/http/http_server.h"
2525

2626
#include "workflow/WFTaskFactory.h"
2727

0 commit comments

Comments
 (0)