github.com/danielpfeifer02/quic-go-prio-packs@v0.41.0-28/internal/congestion/interface.go (about)

     1  package congestion
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/danielpfeifer02/quic-go-prio-packs/internal/protocol"
     7  )
     8  
     9  // A SendAlgorithm performs congestion control
    10  type SendAlgorithm interface {
    11  	TimeUntilSend(bytesInFlight protocol.ByteCount) time.Time
    12  	HasPacingBudget(now time.Time) bool
    13  	OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool)
    14  	CanSend(bytesInFlight protocol.ByteCount) bool
    15  	MaybeExitSlowStart()
    16  	OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime time.Time)
    17  	OnCongestionEvent(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount)
    18  	OnRetransmissionTimeout(packetsRetransmitted bool)
    19  	SetMaxDatagramSize(protocol.ByteCount)
    20  }
    21  
    22  // A SendAlgorithmWithDebugInfos is a SendAlgorithm that exposes some debug infos
    23  type SendAlgorithmWithDebugInfos interface {
    24  	SendAlgorithm
    25  	InSlowStart() bool
    26  	InRecovery() bool
    27  	GetCongestionWindow() protocol.ByteCount
    28  }