github.com/psiphon-Labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/quic/gquic-go/internal/flowcontrol/interface.go (about)

     1  package flowcontrol
     2  
     3  import "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/quic/gquic-go/internal/protocol"
     4  
     5  type flowController interface {
     6  	// for sending
     7  	SendWindowSize() protocol.ByteCount
     8  	UpdateSendWindow(protocol.ByteCount)
     9  	AddBytesSent(protocol.ByteCount)
    10  	// for receiving
    11  	AddBytesRead(protocol.ByteCount)
    12  	GetWindowUpdate() protocol.ByteCount // returns 0 if no update is necessary
    13  	MaybeQueueWindowUpdate()             //  queues a window update, if necessary
    14  	IsNewlyBlocked() (bool, protocol.ByteCount)
    15  }
    16  
    17  // A StreamFlowController is a flow controller for a QUIC stream.
    18  type StreamFlowController interface {
    19  	flowController
    20  	// for receiving
    21  	// UpdateHighestReceived should be called when a new highest offset is received
    22  	// final has to be to true if this is the final offset of the stream, as contained in a STREAM frame with FIN bit, and the RST_STREAM frame
    23  	UpdateHighestReceived(offset protocol.ByteCount, final bool) error
    24  }
    25  
    26  // The ConnectionFlowController is the flow controller for the connection.
    27  type ConnectionFlowController interface {
    28  	flowController
    29  }
    30  
    31  type connectionFlowControllerI interface {
    32  	ConnectionFlowController
    33  	// The following two methods are not supposed to be called from outside this packet, but are needed internally
    34  	// for sending
    35  	EnsureMinimumWindowSize(protocol.ByteCount)
    36  	// for receiving
    37  	IncrementHighestReceived(protocol.ByteCount) error
    38  }