Skip to content

Commit 85b8d83

Browse files
committed
2 parents 6c90e39 + 90877c0 commit 85b8d83

File tree

117 files changed

+1898
-2056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1898
-2056
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
run: |
1111
mkdir -p ./pr
1212
echo ${{ github.event.number }} > ./pr/NR
13-
- uses: actions/upload-artifact@v2
13+
- uses: actions/upload-artifact@v4
1414
if: github.event_name == 'pull_request'
1515
with:
1616
name: pr
@@ -20,7 +20,7 @@ jobs:
2020
#
2121
# We need to fetch more than one commit to be able to access HEAD^2 in case
2222
# of a pull request
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 10
2626
# In case of a push event, the commit we care about is simply HEAD.
@@ -46,7 +46,7 @@ jobs:
4646
echo "$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_ENV
4747
echo "EOF" >> $GITHUB_ENV
4848
echo "PREVIOUS_COMMIT=$(git log --format=%H -n 1 HEAD^2~1)" >> $GITHUB_ENV
49-
- uses: actions/setup-python@v4
49+
- uses: actions/setup-python@v5
5050
with:
5151
python-version: '3.10'
5252
architecture: 'x64'
@@ -110,10 +110,10 @@ jobs:
110110
PREVIOUS_COMMIT: ${{ needs.setup.outputs.previous_commit }}
111111
PR_NUMBER: ${{ github.event.pull_request.number }}
112112
steps:
113-
- uses: actions/checkout@v3
113+
- uses: actions/checkout@v4
114114
with:
115115
fetch-depth: 10
116-
- uses: actions/setup-python@v4
116+
- uses: actions/setup-python@v5
117117
with:
118118
python-version: '3.10'
119119
architecture: 'x64'

.github/workflows/get-maintainers.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
get_maintainers:
99
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 10
1414
- name: Get commit branch and commit message from PR
@@ -19,7 +19,7 @@ jobs:
1919
echo "$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_ENV
2020
echo "EOF" >> $GITHUB_ENV
2121
echo "PREVIOUS_COMMIT=$(git log --format=%H -n 1 HEAD^2~1)" >> $GITHUB_ENV
22-
- uses: actions/setup-python@v4
22+
- uses: actions/setup-python@v5
2323
with:
2424
python-version: '3.10'
2525
architecture: 'x64'
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
python ./toolset/github_actions/get_maintainers.py > ./maintainers/maintainers.md
3333
- name: Save Maintainers
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: maintainers
3737
path: maintainers/

.github/workflows/label-failing-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-22.04
1111
steps:
1212
- name: 'Download artifact'
13-
uses: actions/github-script@v3.1.0
13+
uses: actions/github-script@v7
1414
with:
1515
# scripts lightly modified from https://securitylab.github.com/research/github-actions-preventing-pwn-requests
1616
script: |
@@ -32,7 +32,7 @@ jobs:
3232
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
3333
- run: unzip pr.zip
3434
- name: Label PR
35-
uses: actions/github-script@v3
35+
uses: actions/github-script@v7
3636
with:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838
script: |

.github/workflows/ping-maintainers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
steps:
1313
- name: 'Download maintainers artifact'
14-
uses: actions/github-script@v6
14+
uses: actions/github-script@v7
1515
with:
1616
script: |
1717
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
@@ -32,7 +32,7 @@ jobs:
3232
fs.writeFileSync('${{github.workspace}}/maintainers.zip', Buffer.from(download.data));
3333
- run: unzip maintainers.zip
3434
- name: Ping maintainers
35-
uses: actions/github-script@v6
35+
uses: actions/github-script@v7
3636
with:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838
script: |

frameworks/C++/cinatra/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# cinatra Benchmarking Test
22

3-
cinatra is a high-performance, easy-to-use http framework developed in Modern C++ (C++17) with the goal of making it easy and quick to develop web applications using the C++ programming language, located at https://github.com/qicosmos/cinatra
3+
cinatra is a high-performance, easy-to-use http framework developed in Modern C++ (C++20) with the goal of making it easy and quick to develop web applications using the C++ programming language, located at https://github.com/qicosmos/cinatra
44

55
## Testing Source Code
66

7-
* [PLAINTEXT](cinatra_benchmark/main.cpp)
7+
* [PLAINTEXT](example/benchmark.cpp)
88

99
## Test URLs
1010

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
22
"framework": "cinatra",
3-
"tests": [{
4-
"default": {
5-
"plaintext_url": "/plaintext",
6-
"port": 8090,
7-
"approach": "Realistic",
8-
"classification": "Fullstack",
9-
"database": "None",
10-
"framework": "cinatra",
11-
"language": "C++",
12-
"flavor": "None",
13-
"orm": "None",
14-
"platform": "None",
15-
"webserver": "None",
16-
"os": "Linux",
17-
"database_os": "Linux",
18-
"display_name": "cinatra",
19-
"notes": "",
20-
"versus": "cinatra"
3+
"tests": [
4+
{
5+
"default": {
6+
"plaintext_url": "/plaintext",
7+
"port": 8090,
8+
"approach": "Realistic",
9+
"classification": "Fullstack",
10+
"database": "None",
11+
"framework": "cinatra",
12+
"language": "C++",
13+
"flavor": "None",
14+
"orm": "None",
15+
"platform": "None",
16+
"webserver": "None",
17+
"os": "Linux",
18+
"database_os": "Linux",
19+
"display_name": "cinatra",
20+
"notes": "",
21+
"versus": "cinatra"
22+
}
2123
}
22-
}]
23-
}
24+
]
25+
}
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:22.04
22
RUN apt-get update -yqq && \
33
apt-get install -yqq cmake git uuid-dev gcc g++ autoconf
4-
ENV ASIO=/asio
5-
ENV ASIO_INTERNAL=/asio/asio
64
ENV CINATRA=/cinatra
7-
ENV CINATRA_EXAMPLE=/cinatra/example
8-
WORKDIR /
9-
RUN git clone https://github.com/chriskohlhoff/asio.git
10-
WORKDIR $ASIO
11-
RUN git checkout 8087252a0c3c2f0baad96ddbd6554db17a846376
12-
WORKDIR $ASIO_INTERNAL
13-
RUN ./autogen.sh && ./configure
14-
RUN make && make install
155
WORKDIR /
166
RUN git clone https://github.com/qicosmos/cinatra.git
177
WORKDIR $CINATRA
18-
RUN git checkout 5acb35cd72c3f72512c0a55e7dea9e25d7779039
19-
WORKDIR $CINATRA_EXAMPLE
20-
RUN mkdir build && cd build && cmake .. && make
8+
RUN git checkout c9bec308e27174c8b7f0f01c92652509f7b47253
9+
RUN mkdir build && cd build && cmake .. && make -j
2110
EXPOSE 8090
22-
CMD ./build/cinatra_example
11+
CMD ./build/example/benchmark

frameworks/C++/cinatra/cinatra_benchmark/CMakeLists.txt

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,10 @@ include_directories($ENV{CINATRA_HOME})
55
if (MSVC)
66
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
77
else ()
8-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pthread -msse4.2 -std=c++17")
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pthread -std=c++20")
99
endif ()
1010

11-
SET(ENABLE_GZIP OFF)
12-
SET(ENABLE_SSL OFF)
13-
SET(ENABLE_CLIENT_SSL OFF)
14-
SET(ENABLE_ASIO_STANDALONE ON)
11+
add_executable(cinatra_example main.cpp)
12+
target_compile_definitions(cinatra_example PRIVATE ASYNC_SIMPLE_HAS_NOT_AIO)
1513

16-
if (ENABLE_SSL)
17-
add_definitions(-DCINATRA_ENABLE_SSL)
18-
message(STATUS "Use SSL")
19-
endif()
20-
21-
if(ENABLE_GZIP)
22-
add_definitions(-DCINATRA_ENABLE_GZIP)
23-
endif()
24-
25-
if(ENABLE_CLIENT_SSL)
26-
add_definitions(-DCINATRA_ENABLE_CLIENT_SSL)
27-
endif()
28-
29-
if(ENABLE_ASIO_STANDALONE)
30-
add_definitions(-DASIO_STANDALONE)
31-
else()
32-
find_package(Boost 1.60 REQUIRED COMPONENTS system)
33-
endif()
34-
35-
if (ENABLE_SSL)
36-
find_package(OpenSSL REQUIRED)
37-
endif()
38-
if (ENABLE_CLIENT_SSL)
39-
find_package(OpenSSL REQUIRED)
40-
endif()
41-
42-
if (ENABLE_GZIP)
43-
find_package(ZLIB REQUIRED)
44-
endif()
45-
46-
set(CINATRA_EXAMPLE
47-
main.cpp
48-
)
49-
50-
add_executable(${project_name} ${CINATRA_EXAMPLE})
51-
include_directories(${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
52-
53-
target_link_libraries(${project_name} ${Boost_LIBRARIES} uuid -lstdc++fs)
54-
if (ENABLE_SSL)
55-
target_link_libraries(${project_name} ${OPENSSL_LIBRARIES} pthread -ldl)
56-
endif()
57-
58-
if (ENABLE_CLIENT_SSL)
59-
target_link_libraries(${project_name} ${OPENSSL_LIBRARIES} pthread -ldl)
60-
endif()
61-
62-
if (ENABLE_GZIP)
63-
target_link_libraries(${project_name} ${ZLIB_LIBRARIES})
64-
endif()
6514
install(TARGETS ${project_name} DESTINATION include)
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
#include <iostream>
21
#include <include/cinatra.hpp>
2+
#include <iostream>
33

44
using namespace cinatra;
5+
using namespace std::chrono_literals;
56

67
int main() {
7-
http_server server(std::thread::hardware_concurrency());
8-
bool r = server.listen("0.0.0.0", "8090");
9-
if (!r) {
10-
std::cout << "listen failed\n";
11-
return -1;
12-
}
13-
14-
server.enable_timeout(false);
15-
server.set_http_handler<GET>("/plaintext", [](request& req, response& res) {
16-
res.set_status_and_content<status_type::ok,res_content_type::string>("Hello, World!");
17-
});
18-
19-
server.run();
20-
return 0;
8+
coro_http_server server(std::thread::hardware_concurrency(), 8090);
9+
server.set_http_handler<GET>(
10+
"/plaintext", [](coro_http_request &req, coro_http_response &resp) {
11+
resp.need_date_head(false);
12+
resp.set_status_and_content(status_type::ok, "Hello, world!");
13+
});
14+
server.sync_start();
2115
}

frameworks/C++/treefrog/models/world.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ World &World::operator=(const World &other)
4646

4747
bool World::update()
4848
{
49-
TSqlQueryORMapper<WorldObject> mapper;
50-
mapper.prepare(QStringLiteral("UPDATE world SET randomNumber=? WHERE id=?"));
51-
mapper.addBind(randomNumber()).addBind(id());
52-
return mapper.exec();
49+
return TAbstractModel::update();
5350
}
5451

5552
World World::create(int randomNumber)
@@ -74,10 +71,8 @@ World World::create(const QVariantMap &values)
7471

7572
World World::get(uint id)
7673
{
77-
TSqlQueryORMapper<WorldObject> mapper;
78-
mapper.prepare(QStringLiteral("SELECT * from world WHERE id=?"));
79-
mapper.addBind(id);
80-
return World(mapper.execFirst());
74+
TSqlORMapper<WorldObject> mapper;
75+
return World(mapper.findByPrimaryKey(id));
8176
}
8277

8378
int World::count()

0 commit comments

Comments
 (0)