Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit ccde88b

Browse files
committed
feat: v0.1.10
1 parent 4954986 commit ccde88b

7 files changed

Lines changed: 47 additions & 49 deletions

File tree

frameworks/Rust/hyperlane/Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/Rust/hyperlane/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hyperlane_techempower"
3-
version = "0.1.9"
3+
version = "0.1.10"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["root@ltpp.vip"]
@@ -16,7 +16,7 @@ rand = "0.10.0"
1616
futures = "0.3.31"
1717
num_cpus = "1.17.0"
1818
once_cell = "1.21.3"
19-
hyperlane = "14.1.3"
19+
hyperlane = "15.0.1"
2020
serde_json = "1.0.149"
2121
hyperlane-time = "0.7.22"
2222
serde = { version = "1.0.228", features = ["derive"] }

frameworks/Rust/hyperlane/src/config/fn.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use super::*;
22

33
pub(crate) async fn init_server_config() -> ServerConfig {
44
let server_config: ServerConfig = ServerConfig::new().await;
5-
server_config.port(8080).await;
6-
server_config.disable_nodelay().await;
5+
server_config.port(8080).await.disable_nodelay().await;
76
server_config
87
}
98

frameworks/Rust/hyperlane/src/main.rs

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,33 @@ use {
3030
#[tokio::main]
3131
async fn main() {
3232
init_db().await;
33-
3433
let server_config: ServerConfig = init_server_config().await;
3534
let request_config: RequestConfig = init_request_config().await;
36-
37-
let server: Server = Server::new().await;
38-
server.server_config(server_config).await;
39-
server.request_config(request_config).await;
40-
server.request_middleware::<RequestMiddleware>().await;
41-
server.route::<PlaintextRoute>("/plaintext").await;
42-
server.route::<JsonRoute>("/json").await;
43-
server.route::<CachedQueryRoute>("/cached-quer").await;
44-
server.route::<DbRoute>("/db").await;
45-
server.route::<QueryRoute>("/query").await;
46-
server.route::<FortunesRoute>("/fortunes").await;
47-
server.route::<UpdateRoute>("/upda").await;
48-
49-
let server_hook: ServerControlHook = server.run().await.unwrap();
50-
server_hook.wait().await;
35+
Server::new()
36+
.await
37+
.server_config(server_config)
38+
.await
39+
.request_config(request_config)
40+
.await
41+
.request_middleware::<RequestMiddleware>()
42+
.await
43+
.route::<PlaintextRoute>("/plaintext")
44+
.await
45+
.route::<JsonRoute>("/json")
46+
.await
47+
.route::<CachedQueryRoute>("/cached-quer")
48+
.await
49+
.route::<DbRoute>("/db")
50+
.await
51+
.route::<QueryRoute>("/query")
52+
.await
53+
.route::<FortunesRoute>("/fortunes")
54+
.await
55+
.route::<UpdateRoute>("/upda")
56+
.await
57+
.run()
58+
.await
59+
.unwrap()
60+
.wait()
61+
.await;
5162
}

frameworks/Rust/hyperlane/src/route/impl.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ impl ServerHook for JsonRoute {
66
}
77

88
async fn handle(self, ctx: &Context) {
9-
let request_config: RequestConfigData = *REQUEST_CONFIG;
109
let json: Value = json!({
1110
KEY_MESSAGE: RESPONSEDATA_STR
1211
});
@@ -21,7 +20,7 @@ impl ServerHook for JsonRoute {
2120
ctx.closed().await;
2221
return;
2322
}
24-
while ctx.http_from_stream(&request_config).await.is_ok() {
23+
while ctx.http_from_stream().await.is_ok() {
2524
if run().await {
2625
ctx.closed().await;
2726
return;
@@ -36,7 +35,6 @@ impl ServerHook for PlaintextRoute {
3635
}
3736

3837
async fn handle(self, ctx: &Context) {
39-
let request_config: RequestConfigData = *REQUEST_CONFIG;
4038
ctx.set_response_header(CONTENT_TYPE, TEXT_PLAIN)
4139
.await
4240
.set_response_body(&RESPONSEDATA_BIN)
@@ -46,7 +44,7 @@ impl ServerHook for PlaintextRoute {
4644
ctx.closed().await;
4745
return;
4846
}
49-
while ctx.http_from_stream(&request_config).await.is_ok() {
47+
while ctx.http_from_stream().await.is_ok() {
5048
if run().await {
5149
ctx.closed().await;
5250
break;
@@ -62,7 +60,6 @@ impl ServerHook for DbRoute {
6260
}
6361

6462
async fn handle(self, ctx: &Context) {
65-
let request_config: RequestConfigData = *REQUEST_CONFIG;
6663
let db_connection: &DbPoolConnection = get_db_connection();
6764
let run = || async {
6865
let query_row: QueryRow = random_world_row(db_connection).await;
@@ -76,7 +73,7 @@ impl ServerHook for DbRoute {
7673
ctx.closed().await;
7774
return;
7875
}
79-
while ctx.http_from_stream(&request_config).await.is_ok() {
76+
while ctx.http_from_stream().await.is_ok() {
8077
if run().await {
8178
ctx.closed().await;
8279
break;
@@ -92,7 +89,6 @@ impl ServerHook for QueryRoute {
9289
}
9390

9491
async fn handle(self, ctx: &Context) {
95-
let request_config: RequestConfigData = *REQUEST_CONFIG;
9692
let run = || async {
9793
let queries: Queries = ctx
9894
.try_get_request_query(QUERY_DB_QUERY_KEY)
@@ -113,7 +109,7 @@ impl ServerHook for QueryRoute {
113109
ctx.closed().await;
114110
return;
115111
}
116-
while ctx.http_from_stream(&request_config).await.is_ok() {
112+
while ctx.http_from_stream().await.is_ok() {
117113
if run().await {
118114
ctx.closed().await;
119115
break;
@@ -129,7 +125,6 @@ impl ServerHook for FortunesRoute {
129125
}
130126

131127
async fn handle(self, ctx: &Context) {
132-
let request_config: RequestConfigData = *REQUEST_CONFIG;
133128
ctx.set_response_header(
134129
CONTENT_TYPE,
135130
&ContentType::format_content_type_with_charset(TEXT_HTML, UTF8),
@@ -156,7 +151,7 @@ impl ServerHook for FortunesRoute {
156151
ctx.closed().await;
157152
return;
158153
}
159-
while ctx.http_from_stream(&request_config).await.is_ok() {
154+
while ctx.http_from_stream().await.is_ok() {
160155
if run().await {
161156
ctx.closed().await;
162157
break;
@@ -172,7 +167,6 @@ impl ServerHook for UpdateRoute {
172167
}
173168

174169
async fn handle(self, ctx: &Context) {
175-
let request_config: RequestConfigData = *REQUEST_CONFIG;
176170
let run = || async {
177171
let queries: Queries = ctx
178172
.try_get_request_query(UPDATE_DB_QUERY_KEY)
@@ -192,7 +186,7 @@ impl ServerHook for UpdateRoute {
192186
ctx.closed().await;
193187
return;
194188
}
195-
while ctx.http_from_stream(&request_config).await.is_ok() {
189+
while ctx.http_from_stream().await.is_ok() {
196190
if run().await {
197191
ctx.closed().await;
198192
break;
@@ -208,7 +202,6 @@ impl ServerHook for CachedQueryRoute {
208202
}
209203

210204
async fn handle(self, ctx: &Context) {
211-
let request_config: RequestConfigData = *REQUEST_CONFIG;
212205
let run = || async {
213206
let count: Queries = ctx
214207
.try_get_request_query(CACHE_QUERY_KEY)
@@ -228,7 +221,7 @@ impl ServerHook for CachedQueryRoute {
228221
ctx.closed().await;
229222
return;
230223
}
231-
while ctx.http_from_stream(&request_config).await.is_ok() {
224+
while ctx.http_from_stream().await.is_ok() {
232225
if run().await {
233226
ctx.closed().await;
234227
break;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod r#impl;
2-
mod r#static;
32
mod r#struct;
43

5-
pub(crate) use {r#static::*, r#struct::*};
4+
pub(crate) use r#struct::*;
65

76
use super::*;

frameworks/Rust/hyperlane/src/route/static.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)