Home / Type/ Http2LocalFlowController Type — netty Architecture

Http2LocalFlowController Type — netty Architecture

Architecture documentation for the Http2LocalFlowController type/interface in Http2LocalFlowController.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7519c57a_b76f_fd61_88b5_3e252428266e["Http2LocalFlowController"]
  8a4c72f4_47b4_87ef_345f_8463983e7442["Http2LocalFlowController.java"]
  7519c57a_b76f_fd61_88b5_3e252428266e -->|defined in| 8a4c72f4_47b4_87ef_345f_8463983e7442
  style 7519c57a_b76f_fd61_88b5_3e252428266e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LocalFlowController.java lines 22–85

public interface Http2LocalFlowController extends Http2FlowController {
    /**
     * Sets the writer to be use for sending {@code WINDOW_UPDATE} frames. This must be called before any flow
     * controlled data is received.
     *
     * @param frameWriter the HTTP/2 frame writer.
     */
    Http2LocalFlowController frameWriter(Http2FrameWriter frameWriter);

    /**
     * Receives an inbound {@code DATA} frame from the remote endpoint and applies flow control policies to it for both
     * the {@code stream} as well as the connection. If any flow control policies have been violated, an exception is
     * raised immediately, otherwise the frame is considered to have "passed" flow control.
     * <p/>
     * If {@code stream} is {@code null} or closed, flow control should only be applied to the connection window and the
     * bytes are immediately consumed.
     *
     * @param stream the subject stream for the received frame. The connection stream object must not be used. If {@code
     * stream} is {@code null} or closed, flow control should only be applied to the connection window and the bytes are
     * immediately consumed.
     * @param data payload buffer for the frame.
     * @param padding additional bytes that should be added to obscure the true content size. Must be between 0 and
     *                256 (inclusive).
     * @param endOfStream Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
     * @throws Http2Exception if any flow control errors are encountered.
     */
    void receiveFlowControlledFrame(Http2Stream stream, ByteBuf data, int padding,
                                    boolean endOfStream) throws Http2Exception;

    /**
     * Indicates that the application has consumed a number of bytes for the given stream and is therefore ready to
     * receive more data from the remote endpoint. The application must consume any bytes that it receives or the flow
     * control window will collapse. Consuming bytes enables the flow controller to send {@code WINDOW_UPDATE} to
     * restore a portion of the flow control window for the stream.
     * <p/>
     * If {@code stream} is {@code null} or closed (i.e. {@link Http2Stream#state()} method returns {@link
     * Http2Stream.State#CLOSED}), calling this method has no effect.
     *
     * @param stream the stream for which window space should be freed. The connection stream object must not be used.
     * If {@code stream} is {@code null} or closed (i.e. {@link Http2Stream#state()} method returns {@link
     * Http2Stream.State#CLOSED}), calling this method has no effect.
     * @param numBytes the number of bytes to be returned to the flow control window.
     * @return true if a {@code WINDOW_UPDATE} was sent, false otherwise.
     * @throws Http2Exception if the number of bytes returned exceeds the {@link #unconsumedBytes(Http2Stream)} for the
     * stream.
     */
    boolean consumeBytes(Http2Stream stream, int numBytes) throws Http2Exception;

    /**
     * The number of bytes for the given stream that have been received but not yet consumed by the
     * application.
     *
     * @param stream the stream for which window space should be freed.
     * @return the number of unconsumed bytes for the stream.
     */
    int unconsumedBytes(Http2Stream stream);

    /**
     * Get the initial flow control window size for the given stream. This quantity is measured in number of bytes. Note
     * the unavailable window portion can be calculated by {@link #initialWindowSize()} - {@link
     * #windowSize(Http2Stream)}.
     */
    int initialWindowSize(Http2Stream stream);
}

Frequently Asked Questions

What is the Http2LocalFlowController type?
Http2LocalFlowController is a type/interface in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LocalFlowController.java.
Where is Http2LocalFlowController defined?
Http2LocalFlowController is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2LocalFlowController.java at line 22.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free