@@ -14,6 +14,7 @@ import (
1414
1515// HitlessManagerInterface defines the interface for completing handoff operations
1616type HitlessManagerInterface interface {
17+ TrackMovingOperationWithConnID (ctx context.Context , newEndpoint string , deadline time.Time , seqID int64 , connID uint64 ) error
1718 UntrackOperationWithConnID (seqID int64 , connID uint64 )
1819}
1920
@@ -31,8 +32,12 @@ type HandoffRequest struct {
3132// with hitless upgrade support.
3233type PoolHook struct {
3334 // Base dialer for creating connections to new endpoints during handoffs
35+ // args are network and address
3436 baseDialer func (context.Context , string , string ) (net.Conn , error )
3537
38+ // Network type (e.g., "tcp", "unix")
39+ network string
40+
3641 // Event-driven handoff support
3742 handoffQueue chan HandoffRequest // Queue for handoff requests
3843 shutdown chan struct {} // Shutdown signal
@@ -55,7 +60,7 @@ type PoolHook struct {
5560 // Simple state tracking
5661 pending sync.Map // map[uint64]int64 (connID -> seqID)
5762
58- // Configuration for the processor
63+ // Configuration for the hitless upgrade
5964 config * Config
6065
6166 // Hitless manager for operation completion tracking
@@ -66,19 +71,19 @@ type PoolHook struct {
6671}
6772
6873// NewPoolHook creates a new pool hook
69- func NewPoolHook (baseDialer func (context.Context , string , string ) (net.Conn , error ), config * Config , hitlessManager HitlessManagerInterface ) * PoolHook {
70- return NewPoolHookWithPoolSize (baseDialer , config , hitlessManager , 0 )
74+ func NewPoolHook (baseDialer func (context.Context , string , string ) (net.Conn , error ), network string , config * Config , hitlessManager HitlessManagerInterface ) * PoolHook {
75+ return NewPoolHookWithPoolSize (baseDialer , network , config , hitlessManager , 0 )
7176}
7277
7378// NewPoolHookWithPoolSize creates a new pool hook with pool size for better worker defaults
74- func NewPoolHookWithPoolSize (baseDialer func (context.Context , string , string ) (net.Conn , error ), config * Config , hitlessManager HitlessManagerInterface , poolSize int ) * PoolHook {
79+ func NewPoolHookWithPoolSize (baseDialer func (context.Context , string , string ) (net.Conn , error ), network string , config * Config , hitlessManager HitlessManagerInterface , poolSize int ) * PoolHook {
7580 // Apply defaults to any missing configuration fields, using pool size for worker calculations
7681 config = config .ApplyDefaultsWithPoolSize (poolSize )
7782
7883 ph := & PoolHook {
7984 // baseDialer is used to create connections to new endpoints during handoffs
8085 baseDialer : baseDialer ,
81- // Note: CLIENT MAINT_NOTIFICATIONS is handled during client initialization
86+ network : network ,
8287 // handoffQueue is a buffered channel for queuing handoff requests
8388 handoffQueue : make (chan HandoffRequest , config .HandoffQueueSize ),
8489 // shutdown is a channel for signaling shutdown
@@ -551,7 +556,7 @@ func (ph *PoolHook) createEndpointDialer(endpoint string) func(context.Context)
551556 }
552557
553558 // Use the base dialer to connect to the new endpoint
554- return ph .baseDialer (ctx , "tcp" , net .JoinHostPort (host , port ))
559+ return ph .baseDialer (ctx , ph . network , net .JoinHostPort (host , port ))
555560 }
556561}
557562
0 commit comments