Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
314 commits
Select commit Hold shift + click to select a range
895ef97
feat: db
eastspire Mar 16, 2025
8440913
feat: db
eastspire Mar 16, 2025
b349b3c
feat: db
eastspire Mar 16, 2025
b15771b
feat: db
eastspire Mar 16, 2025
674f516
feat: rand
eastspire Mar 16, 2025
394c2ad
feat: rand
eastspire Mar 16, 2025
84336e6
feat: rand
eastspire Mar 16, 2025
2872352
feat: rand
eastspire Mar 16, 2025
2f0398b
feat: rand
eastspire Mar 16, 2025
3f0cc7e
feat: port
eastspire Mar 16, 2025
4c9c41e
feat: port
eastspire Mar 16, 2025
ae191b8
feat: port
eastspire Mar 16, 2025
0dcafc4
feat: db
eastspire Mar 16, 2025
cc5b089
feat: db
eastspire Mar 17, 2025
6234158
feat: db
eastspire Mar 17, 2025
8cf74b0
feat: lock
eastspire Mar 17, 2025
0abbc6b
feat: lock
eastspire Mar 17, 2025
ad24c54
feat: v4.41.0
eastspire Mar 20, 2025
854be9e
feat: v4.42.0
eastspire Mar 21, 2025
87e78ba
Merge remote-tracking branch 'upstream/master'
eastspire Mar 21, 2025
adf4c86
Merge remote-tracking branch 'upstream/master'
eastspire Mar 21, 2025
d96191b
Merge remote-tracking branch 'upstream/master'
eastspire Mar 21, 2025
a4026c2
feat: inline
eastspire Mar 21, 2025
c9e3243
feat: dockerfile
eastspire Mar 21, 2025
1f2fee5
feat: v4.52.1
eastspire Mar 23, 2025
eaf7c49
Merge remote-tracking branch 'upstream/master'
eastspire Mar 23, 2025
f5b3ae7
feat: remove key
eastspire Mar 23, 2025
9e0cda5
remove: log
eastspire Mar 23, 2025
07ad0ee
remove: log
eastspire Mar 23, 2025
31ba915
feat: async
eastspire Mar 23, 2025
73740f6
remove: empty loop
eastspire Mar 23, 2025
e6f7f35
feat: utf8
eastspire Mar 23, 2025
b9f6e00
change: pool_size
eastspire Mar 23, 2025
8f9ee7a
remove: utf8
eastspire Mar 23, 2025
519aa5b
feat: log
eastspire Mar 24, 2025
258d2fe
feat: log
eastspire Mar 24, 2025
bee43f3
feat: v3.14.1
eastspire Mar 24, 2025
0384364
feat: 4.56.3
eastspire Mar 25, 2025
d00934a
Merge remote-tracking branch 'upstream/master'
eastspire Mar 25, 2025
23924c3
feat: 4.56.4
eastspire Mar 25, 2025
eca7315
Merge branch 'TechEmpower:master' into master
eastspire Mar 26, 2025
dc9042f
feat: 4.56.5
eastspire Mar 26, 2025
082b0b9
Merge branch 'master' of github.com:ltpp-universe/FrameworkBenchmarks
eastspire Mar 26, 2025
d5844cd
feat: rename
eastspire Mar 28, 2025
f042a84
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
eastspire Mar 28, 2025
c3a7908
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
eastspire Mar 29, 2025
c81ee64
feat: speed
eastspire Mar 29, 2025
19f5ae6
feat: speed
eastspire Mar 29, 2025
f77a306
lock: toml
eastspire Mar 29, 2025
f6a98ab
lock: toml
eastspire Mar 29, 2025
ceb254c
lock: toml
eastspire Mar 29, 2025
482cc17
lock: toml
eastspire Mar 30, 2025
48bd6e8
lock: toml
eastspire Mar 30, 2025
a567e67
lock: toml
eastspire Mar 30, 2025
6de8e40
lock: toml
eastspire Mar 30, 2025
6b6aba5
lock: toml
eastspire Mar 31, 2025
2c558cc
lock: toml
eastspire Apr 1, 2025
ff0e59d
lock: toml
eastspire Apr 2, 2025
eb4e337
lock: toml
eastspire Apr 3, 2025
efcb34d
lock: toml
eastspire Apr 3, 2025
d364aac
lock: toml
eastspire Apr 4, 2025
fe200ce
feat: runtime
eastspire Apr 4, 2025
636f4e9
feat: runtime
eastspire Apr 4, 2025
2b3c2d6
feat: runtime
eastspire Apr 4, 2025
c51c4b9
lock: toml
eastspire Apr 6, 2025
cc4f519
Merge remote-tracking branch 'upstream/master'
eastspire Apr 6, 2025
16d8137
lock: toml
eastspire Apr 6, 2025
9d35c7f
lock: toml
eastspire Apr 6, 2025
fd7338d
lock: toml
eastspire Apr 6, 2025
368cd48
lock: toml
eastspire Apr 6, 2025
d4b422a
lock: toml
eastspire Apr 6, 2025
e5832b6
lock: toml
eastspire Apr 13, 2025
22ede47
Merge remote-tracking branch 'upstream/master'
eastspire Apr 13, 2025
0c3d1a7
lock: toml
eastspire Apr 14, 2025
3bcb9bf
feat: update
eastspire Apr 15, 2025
efa351d
Merge remote-tracking branch 'upstream/master'
eastspire Apr 15, 2025
267b43c
Merge remote-tracking branch 'upstream/master'
eastspire Apr 15, 2025
8beb352
feat: update
eastspire Apr 15, 2025
e9ff20b
feat: update
eastspire Apr 15, 2025
59bad99
feat: update
eastspire Apr 15, 2025
7338abf
feat: update
eastspire Apr 15, 2025
1c20a45
feat: update
eastspire Apr 15, 2025
c2ddd89
feat: update
eastspire Apr 15, 2025
f23c408
feat: update
eastspire Apr 15, 2025
6ce25ff
feat: update
eastspire Apr 15, 2025
74acef2
feat: update
eastspire Apr 15, 2025
1b81b18
feat: update
eastspire Apr 15, 2025
7a8aaef
feat: update
eastspire Apr 15, 2025
f7152b0
feat: update
eastspire Apr 15, 2025
22dc806
feat: update
eastspire Apr 15, 2025
5065334
feat: update
eastspire Apr 15, 2025
3559f0b
feat: update
eastspire Apr 15, 2025
b1b4030
feat: update
eastspire Apr 16, 2025
9018015
feat: update
eastspire Apr 16, 2025
7f35aa9
feat: update
eastspire Apr 19, 2025
3be757c
feat: update
eastspire Apr 19, 2025
61ed933
feat: update
eastspire Apr 19, 2025
7222c44
feat: update
eastspire Apr 19, 2025
1a438b8
feat: update
eastspire Apr 19, 2025
c7ada5d
feat: update
eastspire Apr 19, 2025
98784c9
Merge remote-tracking branch 'upstream/master'
eastspire Apr 19, 2025
e1879d0
Merge remote-tracking branch 'upstream/master'
eastspire Apr 19, 2025
ca2c258
Merge remote-tracking branch 'upstream/master'
eastspire Apr 24, 2025
a87a913
feat: hyperlane
eastspire Apr 24, 2025
59c6f82
feat: update
eastspire Apr 25, 2025
aa6c74b
docs: readme
eastspire Apr 27, 2025
0004628
feat: update
eastspire May 5, 2025
4c15eba
Merge remote-tracking branch 'upstream/master'
eastspire May 5, 2025
dcb43cf
Merge remote-tracking branch 'upstream/master'
eastspire May 5, 2025
7b272d7
feat: update
eastspire May 8, 2025
3ce635d
feat: update
eastspire May 9, 2025
63446d8
feat: update
eastspire May 11, 2025
8a5ee4c
Merge remote-tracking branch 'upstream/master'
eastspire May 11, 2025
c02f3df
Merge remote-tracking branch 'upstream/master'
eastspire May 11, 2025
b0d7bb3
feat: update
eastspire May 18, 2025
d063a52
Merge remote-tracking branch 'upstream/master'
eastspire May 18, 2025
ad6dd3b
feat: update
eastspire May 18, 2025
0982cb2
feat: update
eastspire May 19, 2025
f2eb74b
feat: update
eastspire May 19, 2025
6e37bfa
feat: update
eastspire May 19, 2025
ea83864
feat: update
eastspire May 20, 2025
95d704a
feat: lock
eastspire May 20, 2025
53ae1a1
feat: use super
eastspire May 21, 2025
6bdae7b
Merge remote-tracking branch 'upstream/master'
eastspire May 21, 2025
ed9585c
feat: update lock
eastspire May 22, 2025
70418f0
Merge remote-tracking branch 'upstream/master'
eastspire May 22, 2025
894f5dd
feat: update
eastspire May 23, 2025
8296a05
feat: update lock
eastspire May 23, 2025
d7601eb
feat: update lock
eastspire May 23, 2025
51a58e5
Merge remote-tracking branch 'upstream/master'
eastspire May 24, 2025
4bce951
feat: update lock
eastspire May 24, 2025
92fa40f
feat: lock
eastspire May 24, 2025
1f8aba7
feat: update lock
eastspire May 25, 2025
3749365
feat: update lock
eastspire May 25, 2025
7a84e6f
feat: update lock
eastspire May 25, 2025
f9d88de
feat: update lock
eastspire May 25, 2025
6981a7b
feat: update lock
eastspire May 25, 2025
ee0846f
feat: update lock
eastspire May 25, 2025
9cecc9c
feat: update lock
eastspire May 26, 2025
a8b1a3c
feat: update lock
eastspire May 26, 2025
891e793
feat: update lock
eastspire May 26, 2025
c05d76b
feat: update lock
eastspire May 27, 2025
abb9714
feat: update lock
eastspire May 28, 2025
d2a1f4a
feat: update lock
eastspire May 28, 2025
f845049
feat: update lock
eastspire May 29, 2025
51bb433
Merge remote-tracking branch 'upstream/master'
eastspire May 29, 2025
202c365
Merge remote-tracking branch 'upstream/master'
eastspire May 29, 2025
54dad08
feat: update
eastspire May 29, 2025
c884aa5
feat: utf8
eastspire May 29, 2025
c6517d4
feat: utf8
eastspire May 29, 2025
2f6718a
Merge remote-tracking branch 'upstream/master'
eastspire May 30, 2025
84a411f
feat: lock
eastspire May 30, 2025
00b1e0c
feat: update
eastspire May 30, 2025
ecec28f
feat: update
eastspire May 30, 2025
9050c56
feat: update
eastspire May 30, 2025
a7c1389
feat: update
eastspire May 31, 2025
4a95a22
feat: update
eastspire Jun 1, 2025
624a144
feat: update
eastspire Jun 2, 2025
cd1d53a
feat: update
eastspire Jun 2, 2025
a9eb9df
feat: update
eastspire Jun 2, 2025
16dd37b
feat: update
eastspire Jun 2, 2025
7cdf458
feat: update
eastspire Jun 4, 2025
8d86146
feat: update
eastspire Jun 4, 2025
f1c7708
feat: update
eastspire Jun 6, 2025
2c2fda8
update: code
eastspire Jun 6, 2025
1d00929
feat: update
eastspire Jun 7, 2025
61bb8ca
feat: update
eastspire Jun 7, 2025
96be513
feat: update
eastspire Jun 9, 2025
216e9ac
feat: update
eastspire Jun 9, 2025
47f2b73
feat: update
eastspire Jun 9, 2025
3c23df6
feat: update
eastspire Jun 9, 2025
cff12cd
feat: update
eastspire Jun 10, 2025
353444b
Merge remote-tracking branch 'upstream/master'
eastspire Jun 10, 2025
3721d3a
Merge remote-tracking branch 'upstream/master'
eastspire Jun 10, 2025
bb52103
feat: update version
eastspire Jun 11, 2025
53d3442
Merge remote-tracking branch 'upstream/master'
eastspire Jun 17, 2025
ef4aa61
feat: update version
eastspire Jun 17, 2025
879098c
update: code
eastspire Jun 20, 2025
be77e27
Merge remote-tracking branch 'upstream/master'
eastspire Jun 20, 2025
3f1d7e2
Merge remote-tracking branch 'upstream/master'
eastspire Jun 20, 2025
0b5ed45
feat: lock
eastspire Jun 21, 2025
b58a03b
feat: lock
eastspire Jun 22, 2025
0bd8967
feat: lock
eastspire Jun 22, 2025
29c8a85
Merge remote-tracking branch 'upstream/master'
eastspire Jun 26, 2025
66be4c6
feat: lock
eastspire Jun 26, 2025
193e585
feat: lock
eastspire Jun 26, 2025
570a729
feat: lock
eastspire Jun 26, 2025
4900228
feat: lock
eastspire Jun 27, 2025
a70b374
feat: error handle
eastspire Jun 28, 2025
de538cf
feat: dep
eastspire Jun 29, 2025
01f3a7b
feat: get_thread_count
eastspire Jun 29, 2025
941bbb9
Merge remote-tracking branch 'upstream/master'
eastspire Jul 4, 2025
0e60472
update: code
eastspire Jul 4, 2025
5a62ddf
feat: lock
eastspire Jul 5, 2025
5cd1ed9
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
eastspire Jul 31, 2025
b1325eb
feat: speed
eastspire Aug 1, 2025
e7bd1f6
feat: speed
eastspire Aug 1, 2025
ebe4c11
update: code
eastspire Aug 1, 2025
2a676d2
feat: speed
eastspire Aug 1, 2025
2377d0c
update: code
eastspire Aug 1, 2025
a7931f6
feat: lock
eastspire Aug 2, 2025
426a2a9
fix: Framework hyperlane does not define a default test in benchmark_…
eastspire Aug 2, 2025
469a354
feat: hyperlane http version
eastspire Aug 2, 2025
127fe15
feat: hyperlane http version
eastspire Aug 2, 2025
239c15c
feat: toml
eastspire Aug 2, 2025
474eefc
feat: toml
eastspire Aug 5, 2025
6ac3a06
feat: toml
eastspire Aug 5, 2025
ef0a183
feat: toml
eastspire Aug 5, 2025
9d1789f
feat: v0.1.0
eastspire Aug 6, 2025
0392d71
feat: toml
eastspire Aug 6, 2025
01d85d0
feat: v6
eastspire Aug 7, 2025
b595604
feat: v6
eastspire Aug 7, 2025
22c0fc7
feat: v6
eastspire Aug 10, 2025
09a0e50
feat: v6
eastspire Aug 10, 2025
f8abd6a
feat: v6
eastspire Aug 10, 2025
51c4f81
debug: test cache
eastspire Aug 10, 2025
68abae2
debug: test cache
eastspire Aug 10, 2025
abd4ae5
feat: v6
eastspire Aug 10, 2025
50bf9ff
feat: send unwrap
eastspire Aug 10, 2025
7954fd0
feat: v6
eastspire Aug 10, 2025
4c2e913
feat: v6
eastspire Aug 10, 2025
3cb0112
Merge remote-tracking branch 'upstream/master'
eastspire Aug 15, 2025
811cda7
feat: v0.1.0
eastspire Aug 15, 2025
4705f6e
feat: toml
eastspire Aug 15, 2025
efc8ea1
feat: toml
eastspire Aug 16, 2025
ef12749
feat: db
eastspire Aug 16, 2025
5b6d8e8
feat: toml
eastspire Aug 17, 2025
13c0a43
feat: toml
eastspire Aug 18, 2025
80d0356
Merge remote-tracking branch 'upstream/master'
eastspire Aug 24, 2025
82dc5b3
feat: toml
eastspire Aug 24, 2025
30258a3
feat: toml
eastspire Aug 24, 2025
b7bb2d3
feat: dir update
eastspire Aug 25, 2025
b1699b3
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
eastspire Sep 4, 2025
320590c
feat: toml
eastspire Sep 5, 2025
a507a59
feat: toml
eastspire Sep 6, 2025
1164733
feat: toml
eastspire Sep 8, 2025
83e22d4
feat: toml
eastspire Sep 14, 2025
6e2fd3f
feat: toml
eastspire Sep 14, 2025
1f7a082
feat: toml
eastspire Sep 14, 2025
b8d0c35
feat: toml
eastspire Sep 14, 2025
fec4405
feat: toml
eastspire Sep 14, 2025
9a9dc38
feat: toml
eastspire Sep 14, 2025
08fd74b
feat: toml
eastspire Sep 14, 2025
9a9c469
feat: toml
eastspire Sep 14, 2025
765804f
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
eastspire Sep 28, 2025
ab35c83
feat: toml
eastspire Sep 28, 2025
fdca6a2
Merge remote-tracking branch 'upstream/master'
eastspire Oct 8, 2025
7effa8e
feat: toml
eastspire Oct 8, 2025
9a853e1
feat: toml
eastspire Oct 20, 2025
81aa3d3
feat: 2025-10-20 21:18:47
eastspire Oct 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
371 changes: 205 additions & 166 deletions frameworks/Rust/hyperlane/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frameworks/Rust/hyperlane/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ exclude = [

[dependencies]
futures = "0.3.31"
hyperlane = "9.5.0"
hyperlane-time = "0.7.8"
hyperlane = "10.6.0"
hyperlane-time = "0.7.12"
num_cpus = "1.17.0"
once_cell = "1.21.3"
rand = "0.9.2"
Expand Down
34 changes: 17 additions & 17 deletions frameworks/Rust/hyperlane/src/db/fn.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use super::*;

pub fn get_db_connection() -> &'static DbPoolConnection {
pub(crate) fn get_db_connection() -> &'static DbPoolConnection {
&DB
}

#[cfg(feature = "dev")]
pub async fn create_database() {
pub(crate) async fn create_database() {
let db_pool: &DbPoolConnection = get_db_connection();
let _ = db_query(&format!("CREATE DATABASE {DATABASE_NAME};"))
.execute(db_pool)
.await;
}

#[cfg(feature = "dev")]
pub async fn create_table() {
pub(crate) async fn create_table() {
let db_pool: &DbPoolConnection = get_db_connection();
let _ = db_query(&format!(
"CREATE TABLE IF NOT EXISTS {TABLE_NAME_WORLD} (
Expand All @@ -32,7 +32,7 @@ pub async fn create_table() {
}

#[cfg(feature = "dev")]
pub async fn insert_records() {
pub(crate) async fn insert_records() {
let db_pool: &DbPoolConnection = get_db_connection();
let row: PgRow = db_query(&format!("SELECT COUNT(*) FROM {TABLE_NAME_WORLD}"))
.fetch_one(db_pool)
Expand Down Expand Up @@ -66,7 +66,7 @@ pub async fn insert_records() {
let _ = db_query(&sql).execute(db_pool).await;
}

pub async fn init_cache() -> Vec<QueryRow> {
pub(crate) async fn init_cache() -> Vec<QueryRow> {
let mut res: Vec<QueryRow> = Vec::with_capacity(RANDOM_MAX as usize);
let db_pool: &DbPoolConnection = get_db_connection();
let sql: String = format!("SELECT id, randomNumber FROM {TABLE_NAME_WORLD} LIMIT {RANDOM_MAX}");
Expand All @@ -80,7 +80,7 @@ pub async fn init_cache() -> Vec<QueryRow> {
res
}

pub async fn connection_db() -> DbPoolConnection {
pub(crate) async fn connection_db() -> DbPoolConnection {
let db_url: &str = match option_env!("POSTGRES_URL") {
Some(it) => it,
_ => &format!(
Expand All @@ -100,7 +100,7 @@ pub async fn connection_db() -> DbPoolConnection {
pool
}

pub async fn get_update_data(limit: Queries) -> (Vec<QueryRow>, Vec<i32>, Vec<i32>) {
pub(crate) async fn get_update_data(limit: Queries) -> (Vec<QueryRow>, Vec<i32>, Vec<i32>) {
let db_pool: &DbPoolConnection = get_db_connection();
let mut query_res_list: Vec<QueryRow> = Vec::with_capacity(limit as usize);
let rows: Vec<QueryRow> = get_some_row_id(limit, db_pool).await;
Expand All @@ -115,32 +115,32 @@ pub async fn get_update_data(limit: Queries) -> (Vec<QueryRow>, Vec<i32>, Vec<i3
(query_res_list, id_list, random_numbers)
}

pub async fn init_db() {
pub(crate) async fn init_db() {
#[cfg(feature = "dev")]
{
create_database().await;
create_table().await;
insert_records().await;
}
let _ = get_db_connection();
let _ = CACHE.get(0);
let _ = CACHE.first();
}

pub async fn random_world_row(db_pool: &DbPoolConnection) -> QueryRow {
pub(crate) async fn random_world_row(db_pool: &DbPoolConnection) -> QueryRow {
let random_id: Queries = get_random_id();
query_world_row(db_pool, random_id).await
}

pub async fn query_world_row(db_pool: &DbPoolConnection, id: Queries) -> QueryRow {
pub(crate) async fn query_world_row(db_pool: &DbPoolConnection, id: Queries) -> QueryRow {
let sql: &str = "SELECT id, randomNumber FROM World WHERE id = $1";
if let Ok(rows) = db_query(sql).bind(id).fetch_one(db_pool).await {
let random_number: i32 = rows.get(KEY_RANDOM_NUMBER);
return QueryRow::new(id as i32, random_number);
return QueryRow::new(id, random_number);
}
return QueryRow::new(id as i32, 1);
QueryRow::new(id, 1)
}

pub async fn update_world_rows(limit: Queries) -> Vec<QueryRow> {
pub(crate) async fn update_world_rows(limit: Queries) -> Vec<QueryRow> {
let db_pool: &DbPoolConnection = get_db_connection();
let (data, id_list, random_numbers) = get_update_data(limit).await;
let sql: &str = "UPDATE World SET randomNumber = $1 WHERE id = $2";
Expand All @@ -159,14 +159,14 @@ pub async fn update_world_rows(limit: Queries) -> Vec<QueryRow> {
data
}

pub async fn all_world_row() -> Vec<PgRow> {
pub(crate) async fn all_world_row() -> Vec<PgRow> {
let db_pool: &DbPoolConnection = get_db_connection();
let sql: String = format!("SELECT id, message FROM {TABLE_NAME_FORTUNE}");
let res: Vec<PgRow> = db_query(&sql).fetch_all(db_pool).await.unwrap_or_default();
return res;
res
}

pub async fn get_some_row_id(limit: Queries, db_pool: &DbPoolConnection) -> Vec<QueryRow> {
pub(crate) async fn get_some_row_id(limit: Queries, db_pool: &DbPoolConnection) -> Vec<QueryRow> {
let tasks: Vec<_> = (0..limit)
.map(|_| {
let db_pool: Pool<Postgres> = db_pool.clone();
Expand Down
6 changes: 3 additions & 3 deletions frameworks/Rust/hyperlane/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pub(crate) mod r#fn;
pub(crate) mod r#static;
pub(crate) mod r#type;

pub use r#fn::*;
pub use r#static::*;
pub use r#type::*;
pub(crate) use r#fn::*;
pub(crate) use r#static::*;
pub(crate) use r#type::*;

use super::*;
34 changes: 27 additions & 7 deletions frameworks/Rust/hyperlane/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ pub(crate) use std::fmt;

pub(crate) use futures::{executor::block_on, future::join_all};
pub(crate) use hyperlane::{
tokio::{
runtime::{Builder, Runtime},
spawn,
task::JoinHandle,
},
tokio::{spawn, task::JoinHandle},
*,
};
pub(crate) use hyperlane_time::*;
Expand All @@ -30,6 +26,30 @@ pub(crate) use sqlx::{
query as db_query,
};

fn main() {
run_server();
use middleware::*;
use route::*;

#[tokio::main]
async fn main() {
init_db().await;

let config: ServerConfig = ServerConfig::new().await;
config.host("0.0.0.0").await;
config.port(8080).await;
config.buffer(256).await;
config.disable_linger().await;
config.disable_nodelay().await;

let server: Server = Server::from(config).await;
server.request_middleware::<RequestMiddleware>().await;
server.route::<PlaintextRoute>("/plaintext").await;
server.route::<JsonRoute>("/json").await;
server.route::<CachedQueryRoute>("/cached-quer").await;
server.route::<DbRoute>("/db").await;
server.route::<QueryRoute>("/query").await;
server.route::<FortunesRoute>("/fortunes").await;
server.route::<UpdateRoute>("/upda").await;

let server_hook: ServerControlHook = server.run().await.unwrap_or_default();
server_hook.wait().await;
}
16 changes: 0 additions & 16 deletions frameworks/Rust/hyperlane/src/middleware/fn.rs

This file was deleted.

22 changes: 22 additions & 0 deletions frameworks/Rust/hyperlane/src/middleware/impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use super::*;

impl ServerHook for RequestMiddleware {
async fn new(_ctx: &Context) -> Self {
Self
}

async fn handle(self, ctx: &Context) {
ctx.set_response_version(HttpVersion::HTTP1_1)
.await
.set_response_header(CONNECTION, KEEP_ALIVE)
.await
.set_response_header(SERVER, HYPERLANE)
.await
.set_response_header(DATE, &gmt())
.await
.set_response_status_code(200)
.await
.set_response_header(CONTENT_TYPE, APPLICATION_JSON)
.await;
}
}
5 changes: 3 additions & 2 deletions frameworks/Rust/hyperlane/src/middleware/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub(crate) mod r#fn;
pub(crate) mod r#impl;
pub(crate) mod r#struct;

pub use r#fn::*;
pub(crate) use r#struct::*;

use super::*;
1 change: 1 addition & 0 deletions frameworks/Rust/hyperlane/src/middleware/struct.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub(crate) struct RequestMiddleware;
148 changes: 0 additions & 148 deletions frameworks/Rust/hyperlane/src/route/fn.rs

This file was deleted.

Loading
Loading