@@ -38,34 +38,34 @@ import NIOHTTP1
3838/// When the `HTTPClient` shall send an HTTP request, it will use its `HTTPConnectionPool.Manager` to
3939/// determine the `HTTPConnectionPool` to run the request on. After a `HTTPConnectionPool` has been
4040/// found for the request, the request will be executed on this connection pool. Since the HTTP
41- /// request implements the `HTTPScheduledRequest ` protocol, the HTTP connection pool can communicate
41+ /// request implements the `HTTPSchedulableRequest ` protocol, the HTTP connection pool can communicate
4242/// with the request. The `HTTPConnectionPool` implements the `HTTPRequestScheduler` protocol.
4343///
4444/// 1. The `HTTPConnectionPool` tries to find an idle connection for the request based on its
4545/// `eventLoopPreference`.
4646///
4747/// 2. If an idle connection is available to the request, the request will be passed to the
4848/// connection right away. In this case the `HTTPConnectionPool` will only use the
49- /// `HTTPScheduledRequest `'s `eventLoopPreference` property. No other methods will be called.
49+ /// `HTTPSchedulableRequest `'s `eventLoopPreference` property. No other methods will be called.
5050///
5151/// 3. If no idle connection is available to the request, the request will be queued for execution:
5252/// - The `HTTPConnectionPool` will inform the request that it is queued for execution by
5353/// calling: `requestWasQueued(_: HTTPRequestScheduler)`. The request must store a reference
5454/// to the `HTTPRequestScheduler`. The request must call `cancelRequest(self)` on the
5555/// scheduler, if the request was cancelled, while waiting for execution.
5656/// - The `HTTPConnectionPool` will create a connection deadline based on the
57- /// `HTTPScheduledRequest `'s `connectionDeadline` property. If a connection to execute the
57+ /// `HTTPSchedulableRequest `'s `connectionDeadline` property. If a connection to execute the
5858/// request on, was not found before this deadline the request will be failed.
59- /// - The HTTPConnectionPool will call `fail(_: Error)` on the `HTTPScheduledRequest ` to
59+ /// - The HTTPConnectionPool will call `fail(_: Error)` on the `HTTPSchedulableRequest ` to
6060/// inform the request about having overrun the `connectionDeadline`.
6161///
6262///
6363/// ## Request is executing
6464///
6565/// After the `HTTPConnectionPool` has identified a connection for the request to be run on, it will
6666/// execute the request on this connection. (Implementation detail: This happens by writing the
67- /// `HTTPExecutingRequest ` to a `NIO.Channel`. We expect the last handler in the `ChannelPipeline`
68- /// to have an `OutboundIn` type of `HTTPExecutingRequest `. Further we expect that the handler
67+ /// `HTTPExecutableRequest ` to a `NIO.Channel`. We expect the last handler in the `ChannelPipeline`
68+ /// to have an `OutboundIn` type of `HTTPExecutableRequest `. Further we expect that the handler
6969/// also conforms to the protocol `HTTPRequestExecutor` to allow communication of the request with
7070/// the executor/`ChannelHandler`).
7171///
@@ -74,7 +74,7 @@ import NIOHTTP1
7474/// 1. The request executor will call `willExecuteRequest(_: HTTPRequestExecutor)` on the
7575/// request. The request is expected to keep a reference to the `HTTPRequestExecutor` that was
7676/// passed to the request for further communication.
77- /// 2. The request sending is started by the executor accessing the `HTTPExecutingRequest `'s
77+ /// 2. The request sending is started by the executor accessing the `HTTPExecutableRequest `'s
7878/// property `requestHead: HTTPRequestHead`. Based on the `requestHead` the executor can
7979/// determine if the request has a body (Is a "content-length" or "transfer-encoding"
8080/// header present?).
@@ -83,31 +83,31 @@ import NIOHTTP1
8383/// `requestHeadSent(_: HTTPRequestHead)`
8484/// 4. If the request has a body the request executor will, ask the request for body data, by
8585/// calling `startRequestBodyStream()`. The request is expected to call
86- /// `writeRequestBodyPart(_: IOData, task: HTTPExecutingRequest )` on the executor with body
86+ /// `writeRequestBodyPart(_: IOData, task: HTTPExecutableRequest )` on the executor with body
8787/// data.
8888/// - The executor can signal backpressure to the request by calling
8989/// `pauseRequestBodyStream()`. In this case the request is expected to stop calling
90- /// `writeRequestBodyPart(_: IOData, task: HTTPExecutingRequest )`. However because of race
90+ /// `writeRequestBodyPart(_: IOData, task: HTTPExecutableRequest )`. However because of race
9191/// conditions the executor is prepared to process more data, even though it asked the
9292/// request to pause.
9393/// - Once the executor is able to send more data, it will notify the request by calling
9494/// `resumeRequestBodyStream()` on the request.
9595/// - The request shall call `finishRequestBodyStream()` on the executor to signal that the
9696/// request body was sent.
9797/// 5. Once the executor receives a http response from the Channel, it will forward the http
98- /// response head to the `HTTPExecutingRequest ` by calling `receiveResponseHead` on it.
98+ /// response head to the `HTTPExecutableRequest ` by calling `receiveResponseHead` on it.
9999/// - The executor will forward all the response body parts it receives in a single read to
100- /// the `HTTPExecutingRequest ` without any buffering by calling
100+ /// the `HTTPExecutableRequest ` without any buffering by calling
101101/// `receiveResponseBodyPart(_ buffer: ByteBuffer)` right away. It is the task's job to
102102/// buffer the responses for user consumption.
103103/// - Once the executor has finished a read, it will not schedule another read, until the
104- /// request calls `demandResponseBodyStream(task: HTTPExecutingRequest )` on the executor.
104+ /// request calls `demandResponseBodyStream(task: HTTPExecutableRequest )` on the executor.
105105/// - Once the executor has received the response's end, it will forward this message by
106- /// calling `receiveResponseEnd()` on the `HTTPExecutingRequest `.
106+ /// calling `receiveResponseEnd()` on the `HTTPExecutableRequest `.
107107/// 6. If a channel error occurs during the execution of the request, or if the channel becomes
108108/// inactive the executor will notify the request by calling `fail(_ error: Error)` on it.
109109/// 7. If the request is cancelled, while it is executing on the executor, it must call
110- /// `cancelRequest(task: HTTPExecutingRequest )` on the executor.
110+ /// `cancelRequest(task: HTTPExecutableRequest )` on the executor.
111111///
112112///
113113/// ## Further notes
@@ -133,13 +133,13 @@ import NIOHTTP1
133133/// This protocol is only intended to be implemented by the `HTTPConnectionPool`.
134134protocol HTTPRequestScheduler {
135135 /// Informs the task queuer that a request has been cancelled.
136- func cancelRequest( _: HTTPScheduledRequest )
136+ func cancelRequest( _: HTTPSchedulableRequest )
137137}
138138
139139/// An abstraction over a request that we want to send. A request may need to communicate with its request
140140/// queuer and executor. The client's methods will be called synchronously on an `EventLoop` by the
141141/// executor. For this reason it is very important that the implementation of these functions never blocks.
142- protocol HTTPScheduledRequest : AnyObject {
142+ protocol HTTPSchedulableRequest : HTTPExecutableRequest {
143143 /// The task's logger
144144 var logger : Logger { get }
145145
@@ -165,28 +165,28 @@ protocol HTTPRequestExecutor {
165165 /// Writes a body part into the channel pipeline
166166 ///
167167 /// This method may be **called on any thread**. The executor needs to ensure thread safety.
168- func writeRequestBodyPart( _: IOData , request: HTTPExecutingRequest )
168+ func writeRequestBodyPart( _: IOData , request: HTTPExecutableRequest )
169169
170170 /// Signals that the request body stream has finished
171171 ///
172172 /// This method may be **called on any thread**. The executor needs to ensure thread safety.
173- func finishRequestBodyStream( _ task: HTTPExecutingRequest )
173+ func finishRequestBodyStream( _ task: HTTPExecutableRequest )
174174
175175 /// Signals that more bytes from response body stream can be consumed.
176176 ///
177177 /// The request executor will call `receiveResponseBodyPart(_ buffer: ByteBuffer)` with more data after
178178 /// this call.
179179 ///
180180 /// This method may be **called on any thread**. The executor needs to ensure thread safety.
181- func demandResponseBodyStream( _ task: HTTPExecutingRequest )
181+ func demandResponseBodyStream( _ task: HTTPExecutableRequest )
182182
183183 /// Signals that the request has been cancelled.
184184 ///
185185 /// This method may be **called on any thread**. The executor needs to ensure thread safety.
186- func cancelRequest( _ task: HTTPExecutingRequest )
186+ func cancelRequest( _ task: HTTPExecutableRequest )
187187}
188188
189- protocol HTTPExecutingRequest : AnyObject {
189+ protocol HTTPExecutableRequest : AnyObject {
190190 /// The request's head.
191191 ///
192192 /// The HTTP request head, that shall be sent. The HTTPRequestExecutor **will not** run any validation
0 commit comments