github.com/daeuniverse/quic-go@v0.0.0-20240413031024-943f218e0810/internal/flowcontrol/interface.go (about) 1 package flowcontrol 2 3 import "github.com/daeuniverse/quic-go/internal/protocol" 4 5 type flowController interface { 6 // for sending 7 SendWindowSize() protocol.ByteCount 8 UpdateSendWindow(protocol.ByteCount) (updated bool) 9 AddBytesSent(protocol.ByteCount) 10 // for receiving 11 AddBytesRead(protocol.ByteCount) 12 GetWindowUpdate() protocol.ByteCount // returns 0 if no update is necessary 13 IsNewlyBlocked() (bool, protocol.ByteCount) 14 } 15 16 // A StreamFlowController is a flow controller for a QUIC stream. 17 type StreamFlowController interface { 18 flowController 19 // UpdateHighestReceived is called when a new highest offset is received 20 // final has to be to true if this is the final offset of the stream, 21 // as contained in a STREAM frame with FIN bit, and the RESET_STREAM frame 22 UpdateHighestReceived(offset protocol.ByteCount, final bool) error 23 // Abandon is called when reading from the stream is aborted early, 24 // and there won't be any further calls to AddBytesRead. 25 Abandon() 26 } 27 28 // The ConnectionFlowController is the flow controller for the connection. 29 type ConnectionFlowController interface { 30 flowController 31 Reset() error 32 } 33 34 type connectionFlowControllerI interface { 35 ConnectionFlowController 36 // The following two methods are not supposed to be called from outside this packet, but are needed internally 37 // for sending 38 EnsureMinimumWindowSize(protocol.ByteCount) 39 // for receiving 40 IncrementHighestReceived(protocol.ByteCount) error 41 }