Class/Object

akka.http.impl.engine.http2

Http2ServerDemux

Related Docs: object Http2ServerDemux | package http2

Permalink

class Http2ServerDemux extends GraphStage[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream]]

This stage contains all control logic for handling frames and (de)muxing data to/from substreams.

(This is not a final documentation, more like a brain-dump of how it could work.)

The BidiStage consumes and produces FrameEvents from the network. It will output one Http2SubStream for incoming frames per substream and likewise accepts a single Http2SubStream per substream with outgoing frames.

(An alternative API would just push a BidiHttp2SubStream(subStreamFlow: Flow[StreamFrameEvent, StreamFrameEvent]) similarly to IncomingConnection. This would more accurately model the one-to-one relation between incoming and outgoing Http2Substream directions but wouldn't stack so nicely with other BidiFlows.)

Backpressure logic:

* read all incoming frames without applying backpressure * this ensures that all "control" frames are read in a timely manner * though, make sure limits are not exceeded * max connection limit (which limits number of parallel requests) * window sizes for incoming data frames * that means we need to buffer incoming substream data until the user handler (consuming the source in the Http2SubStream) will read it * per-connection and per-stream window updates should reflect how much data was (not) yet passed into the user handler and therefore are the main backpressure mechanism towards the peer * for the outgoing frame side we need to decide which frames to send per incoming demand * control frames (settings, ping, acks, window updates etc.) -> responses to incoming frames * substream frames -> incoming frame data from substreams * to be able to make a decision some data must already be buffered for those two sources of incoming frames

Demultiplexing: * distribute incoming frames to their respective targets: * control frames: handled internally, may generate outgoing control frames directly * incoming HEADERS frames: creates a new Http2SubStream including a SubSource that will receive all upcoming data frames * incoming data frames: buffered and pushed to the SubSource of the respective substream

Multiplexing: * schedule incoming frames from multiple sources to be pushed onto the shared medium * control frames: as generated from the stage itself (should probably preferred over everything else) * Http2SubStream produced by the user handler: read and push initial frame ASAP * outgoing data frames for each of the substreams: will comprise the bulk of the data and is where any clever, prioritizing, etc. i.e. tbd later sending strategies will apply

In the best case we could just flattenMerge the outgoing side (hoping for the best) but this will probably not work because the sending decision relies on dynamic window size and settings information that will be only available in this stage.

Source
Http2ServerDemux.scala
Linear Supertypes
GraphStage[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream]], GraphStageWithMaterializedValue[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed], Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed], AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Http2ServerDemux
  2. GraphStage
  3. GraphStageWithMaterializedValue
  4. Graph
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Http2ServerDemux()

    Permalink

Type Members

  1. type Shape = BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream]

    Permalink
    Definition Classes
    Graph

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to any2stringadd[Http2ServerDemux] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Http2ServerDemux, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to ArrowAssoc[Http2ServerDemux] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def addAttributes(attr: Attributes): Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

    Permalink
    Definition Classes
    Graph
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def async: Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

    Permalink
    Definition Classes
    Graph
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def createLogic(inheritedAttributes: Attributes): GraphStageLogic

    Permalink
    Definition Classes
    Http2ServerDemux → GraphStage
  11. final def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, NotUsed)

    Permalink
    Definition Classes
    GraphStage → GraphStageWithMaterializedValue
  12. def ensuring(cond: (Http2ServerDemux) ⇒ Boolean, msg: ⇒ Any): Http2ServerDemux

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to Ensuring[Http2ServerDemux] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (Http2ServerDemux) ⇒ Boolean): Http2ServerDemux

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to Ensuring[Http2ServerDemux] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: ⇒ Any): Http2ServerDemux

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to Ensuring[Http2ServerDemux] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): Http2ServerDemux

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to Ensuring[Http2ServerDemux] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to StringFormat[Http2ServerDemux] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  20. val frameIn: Inlet[FrameEvent]

    Permalink
  21. val frameOut: Outlet[FrameEvent]

    Permalink
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. def initialAttributes: Attributes

    Permalink
    Attributes
    protected
    Definition Classes
    GraphStageWithMaterializedValue
  25. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  26. final lazy val module: Module

    Permalink
    Definition Classes
    GraphStageWithMaterializedValue → Graph
  27. def named(name: String): Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

    Permalink
    Definition Classes
    Graph
  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. val shape: BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream]

    Permalink
    Definition Classes
    Http2ServerDemux → Graph
  32. val substreamIn: Inlet[Http2SubStream]

    Permalink
  33. val substreamOut: Outlet[Http2SubStream]

    Permalink
  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  35. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  36. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def withAttributes(attr: Attributes): Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

    Permalink
    Definition Classes
    GraphStageWithMaterializedValue → Graph
  40. def [B](y: B): (Http2ServerDemux, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Http2ServerDemux to ArrowAssoc[Http2ServerDemux] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from GraphStage[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream]]

Inherited from GraphStageWithMaterializedValue[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

Inherited from Graph[BidiShape[Http2SubStream, FrameEvent, FrameEvent, Http2SubStream], NotUsed]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Http2ServerDemux to any2stringadd[Http2ServerDemux]

Inherited by implicit conversion StringFormat from Http2ServerDemux to StringFormat[Http2ServerDemux]

Inherited by implicit conversion Ensuring from Http2ServerDemux to Ensuring[Http2ServerDemux]

Inherited by implicit conversion ArrowAssoc from Http2ServerDemux to ArrowAssoc[Http2ServerDemux]

Ungrouped