Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,412 changes: 567 additions & 845 deletions frameworks/mq-bridge/Cargo.lock

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions frameworks/mq-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
# in via a pinned git reference. hyper-util's auto connection builder serves both
# HTTP/1.1 and HTTP/2 prior-knowledge (h2c) on the plaintext port; the same
# builder runs behind the TLS listener, where the library now advertises ALPN
# `h2`. Tracks the `dev` branch to benchmark unreleased code; pin to a `tag` or
# exact `rev` for reproducible benchmarks.
# `h2`. Pinned to a released `tag` so benchmarks are reproducible.
[package]
name = "httparena-mqbridge"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
publish = false

Expand All @@ -19,23 +18,26 @@ name = "httparena-mqbridge"
path = "src/main.rs"

[dependencies]
# `rustls-ring` selects the ring crypto provider for the TLS (8443) listener.
mq-bridge = { git = "https://github.com/marcomq/mq-bridge", tag = "v0.2.21", default-features = false, features = ["http", "rustls-ring"] }
# `rustls-ring` selects the ring crypto provider for the TLS (8443) listener;
# `sqlx` pulls in the library's re-exported sqlx (`mq_bridge::sqlx`) for the
# async-db and crud profiles, keeping one sqlx version in the graph.
mq-bridge = { git = "https://github.com/marcomq/mq-bridge", tag = "v0.4.8", default-features = false, features = ["http", "rustls-ring", "sqlx"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
anyhow = "1"
# Zero-copy bodies + pre-gzip for the in-memory static/json caches.
# Zero-copy response bodies.
bytes = "1"
flate2 = "1"
# Sharded concurrent map behind the crud profile's cache-aside read path.
dashmap = "6"
# Template engine for the fortunes profile: compile-time, auto-escaping, and
# the template lives in its own file, as the profile's standard-mode rules require.
askama = "0.16"
# Install the process-default rustls crypto provider before the TLS endpoint.
rustls = { version = "0.23", default-features = false, features = ["ring"] }
# Async-db profile: own a Postgres pool in the handler (HttpArena seeds an
# `items` table and passes DATABASE_URL).
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio-rustls", "postgres", "json"] }

[profile.release]
opt-level = 3
lto = "thin"
lto = "fat"
codegen-units = 1
panic = "abort"
3 changes: 3 additions & 0 deletions frameworks/mq-bridge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ COPY Cargo.toml .
RUN mkdir src && echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src target/release/httparena-mqbridge* target/release/deps/httparena_mqbridge*
# askama compiles `templates/` at build time, steered by askama.toml.
COPY askama.toml .
COPY templates ./templates
COPY src ./src
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release

Expand Down
5 changes: 5 additions & 0 deletions frameworks/mq-bridge/askama.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Askama's built-in HTML escaper emits numeric entities (`<`), but the
# fortunes validator greps for the named form. See `NamedHtmlEscaper`.
[[escaper]]
path = "crate::NamedHtmlEscaper"
extensions = ["html"]
8 changes: 6 additions & 2 deletions frameworks/mq-bridge/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"mode": "standard",
"completeness": {
"routing": false,
"middleware": false,
"middleware": true,
"request": true,
"response": true
},
"engine": "mq-bridge",
"description": "mq-bridge async message-bridging library run as an HTTP server. A single catch-all http->response route dispatches on request metadata and replies through mq-bridge's inline-response fast path; hyper-util's auto connection builder serves HTTP/1.1 and HTTP/2 prior-knowledge (h2c) on the cleartext port (8080) and HTTP/2-over-TLS (ALPN h2) on 8443. Postgres via sqlx for async-db, dataset read from /data/dataset.json, static assets from /data/static, gzip negotiated by the library's Accept-Encoding-gated response compression.",
"description": "mq-bridge async message-bridging library run as an HTTP server. A single catch-all http->response route dispatches on request metadata and replies through mq-bridge's inline-response fast path; hyper-util's auto connection builder serves HTTP/1.1 and HTTP/2 prior-knowledge (h2c) on the cleartext port (8080) and HTTP/2-over-TLS (ALPN h2) on 8443. Postgres via the library's re-exported sqlx for async-db and crud (in-process cache-aside, one-second TTL), fortunes rendered per request with the Askama template engine, dataset read from /data/dataset.json, static assets from /data/static, response compression negotiated per request by the library from Accept-Encoding (zstd > gzip > lz4).",
"repo": "https://github.com/marcomq/mq-bridge",
"enabled": true,
"tests": [
Expand All @@ -21,7 +21,11 @@
"json-comp",
"json-tls",
"upload",
"static",
"static-tls",
"async-db",
"crud",
"fortunes",
"baseline-h2",
"static-h2",
"baseline-h2c",
Expand Down
Loading