stream

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(streamId uint32, cmd *commands.HttpCommand, initialSendWindowSize uint32, initialReceiveWindowSize uint32, out FlowControlledFrameWriter) *stream

Types

type FlowControlledFrameWriter

type FlowControlledFrameWriter interface {
	Write(frame frames.Frame)
	RemainingSendFlowControlWindowIsEnough(nBytesToWrite int64) bool
	DecreaseSendFlowControlWindow(nBytesToWrite int64)
}

type Stream

type Stream interface {
	StreamId() uint32
	GetState() streamstate.StreamState
	SetState(state streamstate.StreamState)

	RequestHeaders() []hpack.HeaderField

	// Get the received HTTP body (concatenated payloads of DATA frames).
	ResponseBody() []byte

	// With push promises it may happen that a stream is created before the client created an HttpRequest.
	// This method is for associating these streams with a request.
	// If the stream is already associated with a request, the method returns an error.
	AssociateWithCommand(cmd *commands.HttpCommand) error

	// SendFrame doesn't mean the frame is sent directly.
	// DATA frames can be postponed by flow control.
	// However, this method will return immediately, postponed frames will be cached and
	// handled under the hood as soon as a WINDOW_UPDATE is received.
	SendFrame(frame frames.Frame)
	// Handle a received frame for this stream.
	ReceiveFrame(frame frames.Frame)
	// Send RST_STREAM
	CloseWithError(errorCode frames.ErrorCode, msg string)
	// Called by the connection if a WINDOW_UPDATE for the connection is received.
	ProcessPendingDataFrames()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL