Skip to content

Commit 75a0a0f

Browse files
committed
docs: align LikeC4 models and docs with actual class names
1 parent 7fdf75e commit 75a0a0f

10 files changed

Lines changed: 200 additions & 232 deletions

File tree

docs/architecture/engines.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ HTTP/1.0 uses a **close-then-respond** model. Each connection handles exactly on
1515
**Internal composition:**
1616

1717
```
18-
HttpRequestMessage → Http10ConnectionStage → [TcpConnectionStage] → TCP
19-
TCP → [TcpConnectionStage] → Http10ConnectionStage → HttpResponseMessage
18+
HttpRequestMessage → Http10ClientConnectionStage → [TcpConnectionStage] → TCP
19+
TCP → [TcpConnectionStage] → Http10ClientConnectionStage → HttpResponseMessage
2020
```
2121

2222
| Component | Role |
2323
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
24-
| `Http10ConnectionStage` | Unified stage: serialises request to wire bytes (sets `Connection: close`), parses the HTTP/1.0 response, and correlates request/response (FIFO, depth 1) |
24+
| `Http10ClientConnectionStage` | Unified stage: serialises request to wire bytes (sets `Connection: close`), parses the HTTP/1.0 response, and correlates request/response (FIFO, depth 1) |
2525
| `TcpConnectionStage` | TCP transport (from Servus.Akka) — acquires a connection lease from the manager actor, reads/writes bytes |
2626

2727
**Notable behaviours:**
@@ -43,25 +43,25 @@ HTTP/1.1 adds **persistent connections** and **keep-alive control**. The unified
4343
**Internal composition:**
4444

4545
```
46-
HttpRequestMessage → Http11ConnectionStage → [TcpConnectionStage] → TCP
47-
TCP → [TcpConnectionStage] → Http11ConnectionStage → HttpResponseMessage
46+
HttpRequestMessage → Http11ClientConnectionStage → [TcpConnectionStage] → TCP
47+
TCP → [TcpConnectionStage] → Http11ClientConnectionStage → HttpResponseMessage
4848
```
4949

5050
| Component | Role |
5151
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52-
| `Http11ConnectionStage` | Unified stage: serialises request (adds `Host`, `Connection`, `Transfer-Encoding: chunked` as needed), parses HTTP/1.1 responses (handles chunked decoding), correlates request/response (FIFO, depth > 1 enables pipelining), and evaluates keep-alive signals |
52+
| `Http11ClientConnectionStage` | Unified stage: serialises request (adds `Host`, `Connection`, `Transfer-Encoding: chunked` as needed), parses HTTP/1.1 responses (handles chunked decoding), correlates request/response (FIFO, depth > 1 enables pipelining), and evaluates keep-alive signals |
5353
| `TcpConnectionStage` | TCP transport with connection reuse (from Servus.Akka) — returns leases to the pool on keep-alive, requests new connections on close |
5454

5555
**Keep-alive handling:**
5656

57-
After decoding each response, `Http11ConnectionStage` evaluates the `Connection` header internally:
57+
After decoding each response, `Http11ClientConnectionStage` evaluates the `Connection` header internally:
5858

5959
- `Connection: keep-alive` (or HTTP/1.1 default) → the connection lease is returned to the connection manager actor for reuse
6060
- `Connection: close` → the lease is released without returning it to the idle queue; the next request triggers a new connection
6161

6262
**Pipelining:**
6363

64-
`Http11ConnectionStage` uses a FIFO queue internally to correlate requests with responses, enabling HTTP/1.1 pipelining: multiple requests can be in-flight on the same connection, and responses are matched to requests in order.
64+
`Http11ClientConnectionStage` uses a FIFO queue internally to correlate requests with responses, enabling HTTP/1.1 pipelining: multiple requests can be in-flight on the same connection, and responses are matched to requests in order.
6565

6666
---
6767

@@ -76,13 +76,13 @@ HTTP/2 provides **stream multiplexing** — many logical requests share a single
7676
**Internal composition:**
7777

7878
```
79-
HttpRequestMessage → Http20ConnectionStage → [TcpConnectionStage] → TCP
80-
TCP → [TcpConnectionStage] → Http20ConnectionStage → HttpResponseMessage
79+
HttpRequestMessage → Http20ClientConnectionStage → [TcpConnectionStage] → TCP
80+
TCP → [TcpConnectionStage] → Http20ClientConnectionStage → HttpResponseMessage
8181
```
8282

8383
| Component | Role |
8484
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85-
| `Http20ConnectionStage` | Central unified stage: allocates client stream IDs (1, 3, 5, …), HPACK-encodes request headers and emits `HEADERS` + `DATA` frames, handles frame encoding/decoding (9-byte frame header + payload), manages connection-level frames (`SETTINGS`, `PING`, `WINDOW_UPDATE`, `GOAWAY`), tracks connection and stream-level flow control windows, assembles per-stream `HEADERS` + `DATA` frames into `HttpResponseMessage`, and correlates responses by stream ID |
85+
| `Http20ClientConnectionStage` | Central unified stage: allocates client stream IDs (1, 3, 5, …), HPACK-encodes request headers and emits `HEADERS` + `DATA` frames, handles frame encoding/decoding (9-byte frame header + payload), manages connection-level frames (`SETTINGS`, `PING`, `WINDOW_UPDATE`, `GOAWAY`), tracks connection and stream-level flow control windows, assembles per-stream `HEADERS` + `DATA` frames into `HttpResponseMessage`, and correlates responses by stream ID |
8686
| `TcpConnectionStage` | TCP transport (from Servus.Akka) — emits the HTTP/2 connection preface on first connect |
8787

8888
**HPACK header compression:**
@@ -91,7 +91,7 @@ TCP → [TcpConnectionStage] → Http20ConnectionStage → HttpResponseMessage
9191

9292
**Flow control:**
9393

94-
`Http20ConnectionStage` tracks both **connection-level** and **stream-level** window sizes. It emits `WINDOW_UPDATE` frames when the consumer reads data, preventing the remote server from stalling. The Akka.Streams backpressure demand signal is translated into HTTP/2 flow-control credits.
94+
`Http20ClientConnectionStage` tracks both **connection-level** and **stream-level** window sizes. It emits `WINDOW_UPDATE` frames when the consumer reads data, preventing the remote server from stalling. The Akka.Streams backpressure demand signal is translated into HTTP/2 flow-control credits.
9595

9696
---
9797

@@ -106,13 +106,13 @@ HTTP/3 runs over **QUIC** instead of TCP. Each request uses an independent QUIC
106106
**Internal composition:**
107107

108108
```
109-
HttpRequestMessage → Http30ConnectionStage → [QuicConnectionStage] → QUIC
110-
QUIC → [QuicConnectionStage] → Http30ConnectionStage → HttpResponseMessage
109+
HttpRequestMessage → Http30ClientConnectionStage → [QuicConnectionStage] → QUIC
110+
QUIC → [QuicConnectionStage] → Http30ClientConnectionStage → HttpResponseMessage
111111
```
112112

113113
| Component | Role |
114114
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115-
| `Http30ConnectionStage` | Central unified stage: QPACK-encodes request headers, emits `HEADERS` + `DATA` frames over QUIC streams, handles frame encoding/decoding using QUIC variable-length encoding, manages connection-level frames (`SETTINGS`, `GOAWAY`), handles stream multiplexing and lifecycle, assembles per-stream frames into `HttpResponseMessage`, and QPACK-decodes response headers |
115+
| `Http30ClientConnectionStage` | Central unified stage: QPACK-encodes request headers, emits `HEADERS` + `DATA` frames over QUIC streams, handles frame encoding/decoding using QUIC variable-length encoding, manages connection-level frames (`SETTINGS`, `GOAWAY`), handles stream multiplexing and lifecycle, assembles per-stream frames into `HttpResponseMessage`, and QPACK-decodes response headers |
116116
| `QuicConnectionStage` | QUIC transport (from Servus.Akka) — acquires a QUIC connection from the manager actor, writes/reads bytes over QUIC streams |
117117

118118
**QPACK header compression:**
@@ -136,7 +136,7 @@ When a connection arrives at TurboHTTP Server, the server mirrors the client arc
136136
| `Http20ServerEngine` | HTTP/2 | Stream multiplexing over a single connection; uses HPACK header compression; flow-control windows at connection and stream level |
137137
| `Http30ServerEngine` | HTTP/3 | QUIC-based multiplexing with per-stream flow control; uses QPACK header compression; eliminates head-of-line blocking |
138138

139-
Each server engine implements `IServerProtocolEngine` and registers itself with the `ProtocolRouter`. When a connection arrives, the router detects the protocol from the initial bytes (HTTP/1.x format, HTTP/2 preface `PRI * HTTP/2.0`, or QUIC Initial packet) and routes the connection to the appropriate engine's state machine for the duration of that connection.
139+
Each server engine implements `IServerProtocolEngine`. When a connection arrives, the `NegotiatingServerEngine` delegates to `ProtocolRouter` to detect the protocol from ALPN negotiation (TLS) or the initial bytes (HTTP/1.x format, HTTP/2 preface `PRI * HTTP/2.0`, or QUIC Initial packet) and routes the connection to the appropriate version-specific engine for the duration of that connection.
140140

141141
## Related Guides
142142

docs/architecture/pipeline.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ If the cache entry is stale but has an `ETag` or `Last-Modified` validator, `Cac
5959

6060
### 2. Keep-Alive Feedback (HTTP/1.1 only)
6161

62-
After each HTTP/1.1 response, `Http11ConnectionStage` evaluates the `Connection` header internally and decides whether to reuse the TCP connection for the next request or close it and request a new one from the connection manager actor.
62+
After each HTTP/1.1 response, `Http11ClientConnectionStage` evaluates the `Connection` header internally and decides whether to reuse the TCP connection for the next request or close it and request a new one from the connection manager actor.
6363

6464
This loop is invisible to the caller — the `Engine` and higher layers see only a continuous stream of `HttpResponseMessage` objects.
6565

@@ -73,7 +73,7 @@ When `RetryBidiStage` decides a request should be retried, it re-enters the pipe
7373

7474
### 5. QPACK Table Sync (HTTP/3 only)
7575

76-
HTTP/3 uses QPACK for header compression. The server sends decoder table updates on a dedicated QUIC stream; `Http30ConnectionStage` processes these updates internally to keep the encoder and decoder dynamic tables in sync.
76+
HTTP/3 uses QPACK for header compression. The server sends decoder table updates on a dedicated QUIC stream; `Http30ClientConnectionStage` processes these updates internally to keep the encoder and decoder dynamic tables in sync.
7777

7878
---
7979

docs/architecture/scenarios.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Here's what happens when you send a request with different HTTP versions. The de
1818
4. `RedirectBidiStage` and `CookieBidiStage` inject matching cookies from `CookieJar`.
1919
5. `CacheBidiStage` checks the cache — on a miss, the request continues.
2020
6. `ContentEncodingBidiStage` compresses the request body if a compression policy is configured.
21-
7. `Engine` routes the request to `Http10Engine`.
22-
8. `Http10ConnectionStage` serialises the request to bytes with `Connection: close`.
21+
7. `Engine` routes the request to `Http10ClientEngine`.
22+
8. `Http10ClientConnectionStage` serialises the request to bytes with `Connection: close`.
2323
9. `TcpConnectionStage` (from Servus.Akka) requests a connection lease from `TcpConnectionManagerActor` and sends the bytes over TCP.
2424

2525
### Response Path
2626

27-
10. The server's response bytes arrive via TCP and flow through `TcpConnectionStage` into `Http10ConnectionStage`.
28-
11. `Http10ConnectionStage` parses the HTTP/1.0 response (body length determined by `Content-Length` or EOF) and correlates it to the pending request.
27+
10. The server's response bytes arrive via TCP and flow through `TcpConnectionStage` into `Http10ClientConnectionStage`.
28+
11. `Http10ClientConnectionStage` parses the HTTP/1.0 response (body length determined by `Content-Length` or EOF) and correlates it to the pending request.
2929
12. `ContentEncodingBidiStage` decompresses the body if needed.
3030
13. `CacheBidiStage` caches the response if it is cacheable.
3131
14. `RetryBidiStage` passes the response through (no retry needed for a successful response).
@@ -50,7 +50,7 @@ HTTP/1.1 follows the same request/response path as HTTP/1.0 except for one criti
5050

5151
### Keep-Alive Handling
5252

53-
After `Http11ConnectionStage` decodes the response and correlates it to the pending request, it evaluates the `Connection` header internally:
53+
After `Http11ClientConnectionStage` decodes the response and correlates it to the pending request, it evaluates the `Connection` header internally:
5454

5555
- `Connection: keep-alive` (or HTTP/1.1 default) → the connection lease is returned to `TcpConnectionManagerActor` for reuse
5656
- `Connection: close` → the lease is released without returning it to the idle queue; the next request triggers a new connection
@@ -59,7 +59,7 @@ On **reuse**, the next request to the same host can skip connection setup entire
5959

6060
### Pipelining
6161

62-
`Http11ConnectionStage` uses a FIFO queue internally to correlate requests with responses, enabling HTTP/1.1 pipelining: multiple requests can be in-flight on the same connection simultaneously, and responses are matched to requests in order.
62+
`Http11ClientConnectionStage` uses a FIFO queue internally to correlate requests with responses, enabling HTTP/1.1 pipelining: multiple requests can be in-flight on the same connection simultaneously, and responses are matched to requests in order.
6363

6464
---
6565

@@ -73,13 +73,13 @@ HTTP/2 is fundamentally different from HTTP/1.x. A single TCP connection carries
7373

7474
### Request Framing
7575

76-
1. `Http20ConnectionStage` assigns the next available stream ID (1, 3, 5, …), HPACK-encodes the request headers into a `HEADERS` frame, and serialises the body (if any) into `DATA` frame(s).
77-
2. `Http20ConnectionStage` applies connection-level and stream-level flow control — it will withhold frames if the server's receive window is exhausted.
76+
1. `Http20ClientConnectionStage` assigns the next available stream ID (1, 3, 5, …), HPACK-encodes the request headers into a `HEADERS` frame, and serialises the body (if any) into `DATA` frame(s).
77+
2. `Http20ClientConnectionStage` applies connection-level and stream-level flow control — it will withhold frames if the server's receive window is exhausted.
7878
3. `TcpConnectionStage` (from Servus.Akka) sends the frames over TCP (injecting the HTTP/2 connection preface on the first connection).
7979

8080
### Connection-Level Frames
8181

82-
While request/response streams are active, `Http20ConnectionStage` also handles:
82+
While request/response streams are active, `Http20ClientConnectionStage` also handles:
8383

8484
- **`SETTINGS`** — initial and updated connection parameters; acknowledges server `SETTINGS` with `SETTINGS ACK`
8585
- **`PING`** — round-trip latency measurement; responds to server `PING` with `PING ACK`
@@ -88,8 +88,8 @@ While request/response streams are active, `Http20ConnectionStage` also handles:
8888

8989
### Response Assembly
9090

91-
4. Raw bytes from TCP flow through `TcpConnectionStage` into `Http20ConnectionStage`.
92-
5. `Http20ConnectionStage` parses the bytes into HTTP/2 frames (handling partial frames across TCP boundaries), routes connection-level frames to internal handlers, assembles per-stream `HEADERS` + `DATA` frames into an `HttpResponseMessage`, HPACK-decodes response headers, and correlates each assembled response back to its pending request using the stream ID.
91+
4. Raw bytes from TCP flow through `TcpConnectionStage` into `Http20ClientConnectionStage`.
92+
5. `Http20ClientConnectionStage` parses the bytes into HTTP/2 frames (handling partial frames across TCP boundaries), routes connection-level frames to internal handlers, assembles per-stream `HEADERS` + `DATA` frames into an `HttpResponseMessage`, HPACK-decodes response headers, and correlates each assembled response back to its pending request using the stream ID.
9393
6. The response continues through `ContentEncodingBidiStage`, `CacheBidiStage`, `RetryBidiStage`, `CookieBidiStage`, and `RedirectBidiStage` — the same response chain as HTTP/1.x.
9494

9595
### Stream ID Exhaustion
@@ -108,21 +108,21 @@ HTTP/3 replaces TCP with **QUIC**, a UDP-based transport that provides built-in
108108

109109
### Request Framing
110110

111-
1. `Http30ConnectionStage` QPACK-encodes the request headers into a `HEADERS` frame, and the body (if any) into `DATA` frame(s).
112-
2. `Http30ConnectionStage` manages connection-level concerns — `SETTINGS`, `GOAWAY`, and stream lifecycle.
111+
1. `Http30ClientConnectionStage` QPACK-encodes the request headers into a `HEADERS` frame, and the body (if any) into `DATA` frame(s).
112+
2. `Http30ClientConnectionStage` manages connection-level concerns — `SETTINGS`, `GOAWAY`, and stream lifecycle.
113113
3. `QuicConnectionStage` (from Servus.Akka) requests a QUIC connection from `QuicConnectionManagerActor` and sends the bytes over the network.
114114

115115
### Connection-Level Frames
116116

117-
While request/response streams are active, `Http30ConnectionStage` handles:
117+
While request/response streams are active, `Http30ClientConnectionStage` handles:
118118

119119
- **`SETTINGS`** — connection parameters exchanged at startup
120120
- **`GOAWAY`** — graceful shutdown; after receiving `GOAWAY`, no new streams are opened on this connection
121121

122122
### Response Assembly
123123

124-
4. Raw bytes from QUIC flow through `QuicConnectionStage` into `Http30ConnectionStage`.
125-
5. `Http30ConnectionStage` parses the bytes into HTTP/3 frames, routes connection-level frames to internal handlers, assembles per-stream `HEADERS` + `DATA` frames into an `HttpResponseMessage`, and QPACK-decodes response headers.
124+
4. Raw bytes from QUIC flow through `QuicConnectionStage` into `Http30ClientConnectionStage`.
125+
5. `Http30ClientConnectionStage` parses the bytes into HTTP/3 frames, routes connection-level frames to internal handlers, assembles per-stream `HEADERS` + `DATA` frames into an `HttpResponseMessage`, and QPACK-decodes response headers.
126126
6. The response continues through `ContentEncodingBidiStage`, `CacheBidiStage`, `RetryBidiStage`, `CookieBidiStage`, and `RedirectBidiStage` — the same response chain as HTTP/1.x and HTTP/2.
127127

128128
### Key Differences from HTTP/2

0 commit comments

Comments
 (0)