Documentation
¶
Index ¶
Constants ¶
const ( TimerKeyFCClientCleanup transport.TimerKey = 20 TimerKeyFCServerCleanup transport.TimerKey = 21 )
Predefined timer key constants for flow control timers
const FCFeedbackPacketName = "FCFeedback"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionID ¶
ConnectionID uniquely identifies a connection
func (ConnectionID) Key ¶
func (c ConnectionID) Key() uint64
Key returns a binary uint64 representation for efficient map key usage Format: IP (4 bytes in high 48 bits) | Port (2 bytes in low 16 bits)
func (ConnectionID) String ¶
func (c ConnectionID) String() string
String returns a string representation of the connection ID for logging
type FCClientHandler ¶
type FCClientHandler struct {
*FCHandler // Embed base handler
}
FCClientHandler implements the client-side flow control logic
func NewFCClientHandler ¶
func NewFCClientHandler( transportSender TransportSender, timerMgr TimerScheduler, ) *FCClientHandler
NewFCClientHandler creates a new flow control client handler with default configuration
func NewFCClientHandlerWithConfig ¶
func NewFCClientHandlerWithConfig( transportSender TransportSender, timerMgr TimerScheduler, initialReceiveWindow protocol.ByteCount, maxReceiveWindow protocol.ByteCount, ) *FCClientHandler
NewFCClientHandlerWithConfig creates a new flow control client handler with custom configuration
type FCConnectionState ¶
type FCConnectionState struct {
ConnID ConnectionID
LastActivity time.Time
FlowController flowcontrol.ConnectionFlowController // Connection-level flow control
}
FCConnectionState tracks flow control state for a single connection
type FCFeedbackCodec ¶
type FCFeedbackCodec struct{}
FCFeedbackCodec implements PacketCodec for FCFeedback packets
func (*FCFeedbackCodec) Deserialize ¶
func (c *FCFeedbackCodec) Deserialize(data []byte) (any, error)
Deserialize decodes binary data into a FCFeedbackPacket
func (*FCFeedbackCodec) Serialize ¶
func (c *FCFeedbackCodec) Serialize(pkt any, pool *common.BufferPool) ([]byte, error)
Serialize encodes a FCFeedbackPacket into binary format: [PacketTypeID(1B)][SendWindow(8B)] Total: 9 bytes fixed size
type FCFeedbackPacket ¶
type FCFeedbackPacket struct {
PacketTypeID packet.PacketTypeID // 1 byte
SendWindow uint64 // 8 bytes - new send window offset
}
FCFeedbackPacket provides flow control window updates This packet is sent when the receive window needs to be updated (threshold-based), allowing the sender to continue sending data without being flow-control blocked.
type FCHandler ¶
type FCHandler struct {
// contains filtered or unexported fields
}
FCHandler is the base handler containing common state and logic
func (*FCHandler) GetConnectionInfo ¶
func (h *FCHandler) GetConnectionInfo(connID ConnectionID) (sendWindow, receiveWindow protocol.ByteCount, exists bool)
GetConnectionInfo returns flow control info for debugging (optional)
type FCServerHandler ¶
type FCServerHandler struct {
*FCHandler // Embed base handler
}
FCServerHandler implements the server-side flow control logic
func NewFCServerHandler ¶
func NewFCServerHandler( transportSender TransportSender, timerMgr TimerScheduler, ) *FCServerHandler
NewFCServerHandler creates a new flow control server handler with default configuration
func NewFCServerHandlerWithConfig ¶
func NewFCServerHandlerWithConfig( transportSender TransportSender, timerMgr TimerScheduler, initialReceiveWindow protocol.ByteCount, maxReceiveWindow protocol.ByteCount, ) *FCServerHandler
NewFCServerHandlerWithConfig creates a new flow control server handler with custom configuration
type TimerScheduler ¶
type TimerScheduler interface {
Schedule(id transport.TimerKey, duration time.Duration, callback transport.TimerCallback)
SchedulePeriodic(id transport.TimerKey, interval time.Duration, callback transport.TimerCallback)
StopTimer(id transport.TimerKey) bool
}
TimerScheduler interface for managing timers
type TransportSender ¶
type TransportSender interface {
Send(addr string, rpcID uint64, data []byte, pktType packet.PacketType) error
GetPacketRegistry() *packet.PacketRegistry
GetConn() *net.UDPConn
}
TransportSender interface for sending packets (avoid circular dependency)