diff --git a/frameworks/Rust/hyperlane/Cargo.lock b/frameworks/Rust/hyperlane/Cargo.lock index 8970d80fabe..864d42534e8 100644 --- a/frameworks/Rust/hyperlane/Cargo.lock +++ b/frameworks/Rust/hyperlane/Cargo.lock @@ -514,9 +514,9 @@ dependencies = [ [[package]] name = "http-compress" -version = "3.0.5" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3200f5033ff75c1c682550881db3667bb79a4853f310586b25f608c8e139bf" +checksum = "5e981abf4edff64424f5657082bf163bda23100b25a379b0a519b96f02fd8ccb" dependencies = [ "brotli", "flate2", @@ -525,15 +525,15 @@ dependencies = [ [[package]] name = "http-constant" -version = "1.73.2" +version = "1.83.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748cd7866cc9dc74fc039e1cbc9984cb0d86f345fe3099398f2e5bc4bbe74b72" +checksum = "c894fa5134967b007f4eb7d1204240ab3ba52707ef98ccdb49f5adc37076499f" [[package]] name = "http-type" -version = "5.11.5" +version = "5.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d71d2d6886484b34b8912bf1e8d0403edae7be8948dd5ca633b8ad128c005" +checksum = "6d0a1f8d020f929d13d5e095fa61f07c0b4d13474a95658ab6ffbe8144d8306d" dependencies = [ "hex", "http-compress", @@ -549,23 +549,22 @@ dependencies = [ [[package]] name = "hyperlane" -version = "10.16.0" +version = "10.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19cfc3da838b365b4bd08ea61c7f315de3dfea983d2581d8df15c91604838bd7" +checksum = "04b19b86e3244510b04f24a159255a510d02336d81782fec249c3a6a6f9c6cef" dependencies = [ "http-type", "inventory", "lombok-macros", "regex", "serde", - "serde_json", ] [[package]] name = "hyperlane-time" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfe36686e48cccf57cc1f5bb165c960d63abbb1670abc08149ea686917da5ac1" +checksum = "d7604538534f747992bc1b74bab91f4b5d74dbfed987854d2bf4b0313e694a2e" [[package]] name = "hyperlane_techempower" @@ -774,9 +773,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lombok-macros" -version = "1.13.16" +version = "1.13.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "802066947abc9055e2356081b4874916392e1a1df42265606d3cc5e857b867ad" +checksum = "3f0304bd5bbf8dbdaf33068cf13c37bade7e050d403ccc30dfb9808254c07c2e" dependencies = [ "proc-macro2", "quote", @@ -985,9 +984,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] @@ -1195,15 +1194,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -2036,3 +2035,9 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zmij" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" diff --git a/frameworks/Rust/hyperlane/Cargo.toml b/frameworks/Rust/hyperlane/Cargo.toml index ea01c5eaa52..1cf8bdf28d2 100644 --- a/frameworks/Rust/hyperlane/Cargo.toml +++ b/frameworks/Rust/hyperlane/Cargo.toml @@ -13,13 +13,13 @@ exclude = ["target", "Cargo.lock", "sh", ".github", "logs", "**/*.log"] [dependencies] futures = "0.3.31" -hyperlane = "10.16.0" -hyperlane-time = "0.7.14" +hyperlane = "10.23.0" +hyperlane-time = "0.7.15" num_cpus = "1.17.0" once_cell = "1.21.3" rand = "0.9.2" serde = "1.0.228" -serde_json = "1.0.145" +serde_json = "1.0.148" sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres"] } [profile.dev] diff --git a/frameworks/Rust/hyperlane/README.md b/frameworks/Rust/hyperlane/README.md index 8afc763acc2..87f5fe6c4d6 100644 --- a/frameworks/Rust/hyperlane/README.md +++ b/frameworks/Rust/hyperlane/README.md @@ -1,39 +1,39 @@ -# [hyperlane](https://github.com/hyperlane-dev/hyperlane) web framework - -## Description - -> A lightweight, high-performance, and cross-platform Rust HTTP server library built on Tokio. It simplifies modern web service development by providing built-in support for middleware, WebSocket, Server-Sent Events (SSE), and raw TCP communication. With a unified and ergonomic API across Windows, Linux, and MacOS, it enables developers to build robust, scalable, and event-driven network applications with minimal overhead and maximum flexibility. - -## Database - -PostgreSQL. - -## Test URLs - -### Test 1: JSON Encoding - - http://localhost:8080/json - -### Test 2: Single Row Query - - http://localhost:8080/db - -### Test 3: Multi Row Query - - http://localhost:8080/query?q=20 - -### Test 4: Fortunes (Template rendering) - - http://localhost:8080/fortunes - -### Test 5: Update Query - - http://localhost:8080/upda?q=20 - -### Test 6: Plaintext - - http://localhost:8080/plaintext - -### Test 7: Caching - - http://localhost:8080/cached-quer?c=20 +# [hyperlane web framework](https://github.com/hyperlane-dev/hyperlane) + +## Description + +> A lightweight, high-performance, and cross-platform Rust HTTP server library built on Tokio. It simplifies modern web service development by providing built-in support for middleware, WebSocket, Server-Sent Events (SSE), and raw TCP communication. With a unified and ergonomic API across Windows, Linux, and MacOS, it enables developers to build robust, scalable, and event-driven network applications with minimal overhead and maximum flexibility. + +## Database + +PostgreSQL. + +## Test URLs + +### Test 1: JSON Encoding + + http://localhost:8080/json + +### Test 2: Single Row Query + + http://localhost:8080/db + +### Test 3: Multi Row Query + + http://localhost:8080/query?q=20 + +### Test 4: Fortunes (Template rendering) + + http://localhost:8080/fortunes + +### Test 5: Update Query + + http://localhost:8080/upda?q=20 + +### Test 6: Plaintext + + http://localhost:8080/plaintext + +### Test 7: Caching + + http://localhost:8080/cached-quer?c=20 diff --git a/frameworks/Rust/hyperlane/src/middleware/impl.rs b/frameworks/Rust/hyperlane/src/middleware/impl.rs index f0559d8d539..fd4a4f8c2b3 100644 --- a/frameworks/Rust/hyperlane/src/middleware/impl.rs +++ b/frameworks/Rust/hyperlane/src/middleware/impl.rs @@ -6,7 +6,7 @@ impl ServerHook for RequestMiddleware { } async fn handle(self, ctx: &Context) { - ctx.set_response_version(HttpVersion::HTTP1_1) + ctx.set_response_version(HttpVersion::Http1_1) .await .set_response_header(CONNECTION, KEEP_ALIVE) .await diff --git a/frameworks/Rust/hyperlane/src/route/impl.rs b/frameworks/Rust/hyperlane/src/route/impl.rs index 96eb1080be9..64a7091e4df 100644 --- a/frameworks/Rust/hyperlane/src/route/impl.rs +++ b/frameworks/Rust/hyperlane/src/route/impl.rs @@ -15,7 +15,7 @@ impl ServerHook for JsonRoute { ctx.send().await.unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -34,7 +34,7 @@ impl ServerHook for PlaintextRoute { ctx.send().await.unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -57,7 +57,7 @@ impl ServerHook for DbRoute { .unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -87,7 +87,7 @@ impl ServerHook for QueryRoute { .unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -123,7 +123,7 @@ impl ServerHook for FortunesRoute { ctx.set_response_body(&res).await.send().await.unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -152,7 +152,7 @@ impl ServerHook for UpdateRoute { .unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; @@ -181,7 +181,7 @@ impl ServerHook for CachedQueryRoute { .unwrap(); }; run().await; - while ctx.http_from_stream(HTTP_BUFFER).await.is_ok() { + while ctx.http_from_stream(RequestConfig::default()).await.is_ok() { run().await; } ctx.closed().await; diff --git a/frameworks/Rust/hyperlane/src/server/const.rs b/frameworks/Rust/hyperlane/src/server/const.rs index c6c0cd98828..46dec4c7036 100644 --- a/frameworks/Rust/hyperlane/src/server/const.rs +++ b/frameworks/Rust/hyperlane/src/server/const.rs @@ -15,7 +15,6 @@ pub(crate) const KEY_ID: &str = "id"; pub(crate) const KEY_RANDOM_NUMBER: &str = "randomnumber"; pub(crate) const KEY_MESSAGE: &str = "message"; pub(crate) const DB_MAX_CONNECTIONS: u32 = 100; -pub(crate) const HTTP_BUFFER: usize = 256; pub(crate) const QUERY_DB_QUERY_KEY: &str = "q"; pub(crate) const UPDATE_DB_QUERY_KEY: &str = "q"; pub(crate) const CACHE_QUERY_KEY: &str = "c";