maintnotifications
v9.24.1
Documentation
pkg.go.dev ↗Constants
CircuitBreakerClosed (3 declarations)
const ( // CircuitBreakerClosed - normal operation, requests allowed CircuitBreakerClosed = circuitbreaker.StateClosed // CircuitBreakerOpen - failing fast, requests rejected CircuitBreakerOpen = circuitbreaker.StateOpen // CircuitBreakerHalfOpen - testing if service recovered CircuitBreakerHalfOpen = circuitbreaker.StateHalfOpen )
NotificationMoving (7 declarations)
const ( NotificationMoving = "MOVING" // Per-connection handoff notification NotificationMigrating = "MIGRATING" // Per-connection migration start notification - relaxes timeouts NotificationMigrated = "MIGRATED" // Per-connection migration complete notification - clears relaxed timeouts NotificationFailingOver = "FAILING_OVER" // Per-connection failover start notification - relaxes timeouts NotificationFailedOver = "FAILED_OVER" // Per-connection failover complete notification - clears relaxed timeouts NotificationSMigrating = "SMIGRATING" // Cluster slot migrating notification - relaxes timeouts NotificationSMigrated = "SMIGRATED" // Cluster slot migrated notification - unrelaxes timeouts and triggers cluster state reload )
Push notification type constants for maintenance
PoolNameMain
const PoolNameMain = "main"
PoolNameMain is the name used for the main connection pool in metrics.
Variables
ErrInvalidRelaxedTimeout (9 declarations)
var ( ErrInvalidRelaxedTimeout = errors.New(logs.InvalidRelaxedTimeoutError()) ErrInvalidHandoffTimeout = errors.New(logs.InvalidHandoffTimeoutError()) ErrInvalidHandoffWorkers = errors.New(logs.InvalidHandoffWorkersError()) ErrInvalidHandoffQueueSize = errors.New(logs.InvalidHandoffQueueSizeError()) ErrInvalidPostHandoffRelaxedDuration = errors.New(logs.InvalidPostHandoffRelaxedDurationError()) ErrInvalidEndpointType = errors.New(logs.InvalidEndpointTypeError()) ErrInvalidMaintNotifications = errors.New(logs.InvalidMaintNotificationsError()) ErrMaxHandoffRetriesReached = errors.New(logs.MaxHandoffRetriesReachedError()) // ErrInvalidHandoffRetries is returned when the number of handoff retries is invalid ErrInvalidHandoffRetries = errors.New(logs.InvalidHandoffRetriesError()) )
Configuration errors
ErrConnectionMarkedForHandoff (3 declarations)
var ( // ErrConnectionMarkedForHandoff is returned when a connection is marked for handoff // and should not be used until the handoff is complete ErrConnectionMarkedForHandoff = errors.New(logs.ConnectionMarkedForHandoffErrorMessage) // ErrConnectionMarkedForHandoffWithState is returned when a connection is marked for handoff // and should not be used until the handoff is complete ErrConnectionMarkedForHandoffWithState = errors.New(logs.ConnectionMarkedForHandoffErrorMessage + " with state") // ErrConnectionInvalidHandoffState is returned when a connection is in an invalid state for handoff ErrConnectionInvalidHandoffState = errors.New(logs.ConnectionInvalidHandoffStateErrorMessage) )
connection handoff errors
ErrInvalidCircuitBreakerFailureThreshold (3 declarations)
var ( // ErrInvalidCircuitBreakerFailureThreshold is returned when the circuit breaker failure threshold is invalid ErrInvalidCircuitBreakerFailureThreshold = errors.New(logs.InvalidCircuitBreakerFailureThresholdError()) // ErrInvalidCircuitBreakerResetTimeout is returned when the circuit breaker reset timeout is invalid ErrInvalidCircuitBreakerResetTimeout = errors.New(logs.InvalidCircuitBreakerResetTimeoutError()) // ErrInvalidCircuitBreakerMaxRequests is returned when the circuit breaker max requests is invalid ErrInvalidCircuitBreakerMaxRequests = errors.New(logs.InvalidCircuitBreakerMaxRequestsError()) )
circuit breaker configuration errors
ErrCircuitBreakerOpen
var ( // ErrCircuitBreakerOpen is returned when the circuit breaker is open ErrCircuitBreakerOpen = errors.New(logs.CircuitBreakerOpenErrorMessage) )
circuit breaker errors
ErrHandoffQueueFull
var ( // ErrHandoffQueueFull is returned when the handoff queue is full ErrHandoffQueueFull = errors.New(logs.HandoffQueueFullError()) )
Handoff errors
ErrInvalidClient
var ( // ErrInvalidClient is returned when the client does not support push notifications ErrInvalidClient = errors.New(logs.InvalidClientError()) )
Integration errors
ErrInvalidNotification
var ( // ErrInvalidNotification is returned when a notification is in an invalid format ErrInvalidNotification = errors.New(logs.InvalidNotificationError()) )
Notification errors
ErrShutdown
var ( // ErrShutdown is returned when the maintnotifications manager is shutdown ErrShutdown = errors.New(logs.ShutdownError()) )
shutdown errors
Functions
ExampleCircuitBreakerMonitor
func ExampleCircuitBreakerMonitor(poolHook *PoolHook)
ExampleCircuitBreakerMonitor demonstrates how to monitor circuit breaker status
Types
CircuitBreaker
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker wraps the internal circuit breaker with endpoint-specific logging. The inner breaker is held as an unexported field (rather than embedded) so its exported methods are not promoted onto this type; that keeps callers on the wrapper's API and preserves wrapper invariants such as the lastSuccessTime bookkeeping.
CircuitBreaker.Execute
func (cb *CircuitBreaker) Execute(fn func() error) error
Execute runs the given function with circuit breaker protection
CircuitBreaker.GetState
func (cb *CircuitBreaker) GetState() CircuitBreakerState
GetState returns the current state of the circuit breaker
CircuitBreaker.GetStats
func (cb *CircuitBreaker) GetStats() CircuitBreakerStats
GetStats returns current statistics for monitoring
CircuitBreaker.IsOpen
func (cb *CircuitBreaker) IsOpen() bool
IsOpen returns true if the circuit breaker is open (rejecting requests). It uses CheckState so the open->half-open transition is honored once OpenTimeout has elapsed, rather than reporting a stale open state.
IsOpen does not reserve a half-open request slot; callers that gate work on the breaker should use allowRequest so MaxHalfOpenRequests is respected.
CircuitBreakerEntry
type CircuitBreakerEntry struct {
// contains filtered or unexported fields
}
CircuitBreakerEntry wraps a circuit breaker with access tracking
CircuitBreakerManager
type CircuitBreakerManager struct {
// contains filtered or unexported fields
}
CircuitBreakerManager manages circuit breakers for multiple endpoints
CircuitBreakerManager.GetAllStats
func (cbm *CircuitBreakerManager) GetAllStats() []CircuitBreakerStats
GetAllStats returns statistics for all circuit breakers
CircuitBreakerManager.GetCircuitBreaker
func (cbm *CircuitBreakerManager) GetCircuitBreaker(endpoint string) *CircuitBreaker
GetCircuitBreaker returns the circuit breaker for an endpoint, creating it if necessary
CircuitBreakerManager.Reset
func (cbm *CircuitBreakerManager) Reset()
Reset resets all circuit breakers (useful for testing)
CircuitBreakerManager.Shutdown
func (cbm *CircuitBreakerManager) Shutdown()
Shutdown stops the cleanup goroutine
CircuitBreakerState
type CircuitBreakerState = circuitbreaker.State
CircuitBreakerState represents the state of a circuit breaker
CircuitBreakerStats
type CircuitBreakerStats struct {
Endpoint string
State CircuitBreakerState
Failures int64
Successes int64
Requests int64
LastFailureTime time.Time
LastSuccessTime time.Time
}
CircuitBreakerStats provides statistics about a circuit breaker
ClusterStateReloadCallback
type ClusterStateReloadCallback func(ctx context.Context, hostPort string, slotRanges []string)
ClusterStateReloadCallback is a callback function that triggers cluster state reload. This is used by node clients to notify their parent ClusterClient about SMIGRATED notifications. The hostPort parameter indicates the destination node (e.g., "127.0.0.1:6379"). The slotRanges parameter contains the migrated slots (e.g., ["1234", "5000-6000"]). Currently, implementations typically reload the entire cluster state, but in the future this could be optimized to reload only the specific slots.
Config
type Config struct {
// Mode controls how client maintenance notifications are handled.
// Valid values: ModeDisabled, ModeEnabled, ModeAuto
// Default: ModeAuto
Mode Mode
// EndpointType specifies the type of endpoint to request in MOVING notifications.
// Valid values: EndpointTypeAuto, EndpointTypeInternalIP, EndpointTypeInternalFQDN,
// EndpointTypeExternalIP, EndpointTypeExternalFQDN, EndpointTypeNone
// Default: EndpointTypeAuto
EndpointType EndpointType
// RelaxedTimeout is the concrete timeout value to use during
// MIGRATING/FAILING_OVER states to accommodate increased latency.
// This applies to both read and write timeouts.
// Default: 10 seconds
RelaxedTimeout time.Duration
// HandoffTimeout is the maximum time to wait for connection handoff to complete.
// If handoff takes longer than this, the old connection will be forcibly closed.
// Default: 15 seconds (matches server-side eviction timeout)
HandoffTimeout time.Duration
// MaxWorkers is the maximum number of worker goroutines for processing handoff requests.
// Workers are created on-demand and automatically cleaned up when idle.
// If zero, defaults to min(10, PoolSize/2) to handle bursts effectively.
// If explicitly set, enforces minimum of PoolSize/2
//
// Default: min(PoolSize/2, max(10, PoolSize/3)), Minimum when set: PoolSize/2
MaxWorkers int
// HandoffQueueSize is the size of the buffered channel used to queue handoff requests.
// If the queue is full, new handoff requests will be rejected.
// Scales with both worker count and pool size for better burst handling.
//
// Default: max(20×MaxWorkers, PoolSize), capped by MaxActiveConns+1 (if set) or 5×PoolSize
// When set: minimum 200, capped by MaxActiveConns+1 (if set) or 5×PoolSize
HandoffQueueSize int
// PostHandoffRelaxedDuration is how long to keep relaxed timeouts on the new connection
// after a handoff completes. This provides additional resilience during cluster transitions.
// Default: 2 * RelaxedTimeout
PostHandoffRelaxedDuration time.Duration
// Circuit breaker configuration for endpoint failure handling
// CircuitBreakerFailureThreshold is the number of failures before opening the circuit.
// Default: 5
CircuitBreakerFailureThreshold int
// CircuitBreakerResetTimeout is how long to wait before testing if the endpoint recovered.
// Default: 60 seconds
CircuitBreakerResetTimeout time.Duration
// CircuitBreakerMaxRequests is the maximum number of requests allowed in half-open state.
// Default: 3
CircuitBreakerMaxRequests int
// MaxHandoffRetries is the maximum number of times to retry a failed handoff.
// After this many retries, the connection will be removed from the pool.
// Default: 3
MaxHandoffRetries int
}
Config provides configuration options for maintenance notifications
DefaultConfig
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible defaults.
Config.ApplyDefaults
func (c *Config) ApplyDefaults() *Config
ApplyDefaults applies default values to any zero-value fields in the configuration. This ensures that partially configured structs get sensible defaults for missing fields.
Config.ApplyDefaultsWithPoolConfig
func (c *Config) ApplyDefaultsWithPoolConfig(poolSize int, maxActiveConns int) *Config
ApplyDefaultsWithPoolConfig applies default values to any zero-value fields in the configuration, using the provided pool size and max active connections to calculate worker and queue defaults. This ensures that partially configured structs get sensible defaults for missing fields.
Config.ApplyDefaultsWithPoolSize
func (c *Config) ApplyDefaultsWithPoolSize(poolSize int) *Config
ApplyDefaultsWithPoolSize applies default values to any zero-value fields in the configuration, using the provided pool size to calculate worker defaults. This ensures that partially configured structs get sensible defaults for missing fields.
Config.Clone
func (c *Config) Clone() *Config
Clone creates a deep copy of the configuration.
Config.IsEnabled
func (c *Config) IsEnabled() bool
Config.Validate
func (c *Config) Validate() error
Validate checks if the configuration is valid.
EndpointType
type EndpointType string
EndpointType represents the type of endpoint to request in MOVING notifications
EndpointTypeAuto (6 declarations)
const ( EndpointTypeAuto EndpointType = "auto" // Auto-detect based on connection EndpointTypeInternalIP EndpointType = "internal-ip" // Internal IP address EndpointTypeInternalFQDN EndpointType = "internal-fqdn" // Internal FQDN EndpointTypeExternalIP EndpointType = "external-ip" // External IP address EndpointTypeExternalFQDN EndpointType = "external-fqdn" // External FQDN EndpointTypeNone EndpointType = "none" // No endpoint (reconnect with current config) )
Constants for endpoint types
DetectEndpointType
func DetectEndpointType(addr string, tlsEnabled bool) EndpointType
DetectEndpointType automatically detects the appropriate endpoint type based on the connection address and TLS configuration.
TLS behaviour:
- If TLS is enabled: requests FQDN for proper certificate validation (SNI / hostname verification).
- If TLS is disabled: always requests IP for better performance, even when the configured address is a hostname. In that case the hostname is resolved to determine whether it belongs to an internal or external network range.
Internal vs External detection:
- For IPs: uses private IP range detection
- For hostnames: resolves the hostname to an IP address and uses the IP range detection
EndpointType.IsValid
func (e EndpointType) IsValid() bool
IsValid returns true if the endpoint type is valid
EndpointType.String
func (e EndpointType) String() string
String returns the string representation of the endpoint type
HandoffRequest
type HandoffRequest struct {
Conn *pool.Conn
ConnID uint64 // Unique connection identifier
Endpoint string
SeqID int64
Pool pool.Pooler // Pool to remove connection from on failure
}
HandoffRequest represents a request to handoff a connection to a new endpoint
LoggingHook
type LoggingHook struct {
LogLevel int // 0=Error, 1=Warn, 2=Info, 3=Debug
}
LoggingHook is an example hook implementation that logs all notifications.
NewLoggingHook
func NewLoggingHook(logLevel int) *LoggingHook
NewLoggingHook creates a new logging hook with the specified log level. Log levels: 0=Error, 1=Warn, 2=Info, 3=Debug
LoggingHook.PostHook
func (lh *LoggingHook) PostHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error)
PostHook logs the result after processing.
LoggingHook.PreHook
func (lh *LoggingHook) PreHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}) ([]interface{}, bool)
PreHook logs the notification before processing and allows modification.
Manager
type Manager struct {
// contains filtered or unexported fields
}
Manager provides a simplified upgrade functionality with hooks and atomic state.
NewManager
func NewManager(client interfaces.ClientInterface, pool pool.Pooler, config *Config) (*Manager, error)
NewManager creates a new simplified manager.
Manager.AddNotificationHook
func (hm *Manager) AddNotificationHook(notificationHook NotificationHook)
Manager.Close
func (hm *Manager) Close() error
Close closes the manager.
Manager.GetActiveMovingOperations
func (hm *Manager) GetActiveMovingOperations() map[MovingOperationKey]*MovingOperation
GetActiveMovingOperations returns active operations with composite keys. WARNING: This method creates a new map and copies all operations on every call. Use sparingly, especially in hot paths or high-frequency logging.
Manager.GetActiveOperationCount
func (hm *Manager) GetActiveOperationCount() int64
GetActiveOperationCount returns the number of active operations. Uses atomic counter for lock-free operation.
Manager.GetState
func (hm *Manager) GetState() State
GetState returns current state using atomic counter for lock-free operation.
Manager.InitPoolHook
func (hm *Manager) InitPoolHook(baseDialer func(context.Context, string, string) (net.Conn, error))
GetPoolHook creates a pool hook with a custom dialer.
Manager.InitPoolHookForPool
func (hm *Manager) InitPoolHookForPool(p pool.Pooler, baseDialer func(context.Context, string, string) (net.Conn, error))
InitPoolHookForPool attaches a maintnotifications pool hook to an additional pool (e.g. a client's dedicated pipeline connection pool). A fresh, independent *PoolHook is created and bound to the given pool so that connections which fail handoff are removed from the correct pool — the hook's removal target is its own single pool field, so the primary hook cannot be reused for a second pool. The new hook shares this Manager as its operations manager, so MOVING/MIGRATING tracking and notification handling stay centralized across both pools.
Manager.IsHandoffInProgress
func (hm *Manager) IsHandoffInProgress() bool
IsHandoffInProgress returns true if any handoff is in progress. Uses atomic counter for lock-free operation.
Manager.MarkSMigratedSeqIDProcessed
func (hm *Manager) MarkSMigratedSeqIDProcessed(seqID int64) bool
MarkSMigratedSeqIDProcessed attempts to mark a SMIGRATED SeqID as processed. Returns true if this is the first time processing this SeqID (should process), false if it was already processed (should skip). This prevents duplicate processing when multiple connections receive the same notification.
Manager.SetClusterStateReloadCallback
func (hm *Manager) SetClusterStateReloadCallback(callback ClusterStateReloadCallback)
SetClusterStateReloadCallback sets the callback function that will be called when a SMIGRATED notification is received. This allows node clients to notify their parent ClusterClient to reload cluster state.
Manager.TrackMaintNotificationsConn
func (hm *Manager) TrackMaintNotificationsConn(cn *pool.Conn)
TrackMaintNotificationsConn records a connection that successfully enabled maintnotifications so it can be retired if the feature is later disabled for the pool.
Manager.TrackMovingOperationWithConnID
func (hm *Manager) TrackMovingOperationWithConnID(ctx context.Context, newEndpoint string, deadline time.Time, seqID int64, connID uint64) error
TrackMovingOperationWithConnID starts a new MOVING operation with a specific connection ID.
Manager.TriggerClusterStateReload
func (hm *Manager) TriggerClusterStateReload(ctx context.Context, hostPort string, slotRanges []string)
TriggerClusterStateReload calls the cluster state reload callback if it's set. This is called when a SMIGRATED notification is received.
Manager.UntrackMaintNotificationsConn
func (hm *Manager) UntrackMaintNotificationsConn(connID uint64)
UntrackMaintNotificationsConn removes a connection from the enabled maintnotifications set.
Manager.UntrackOperationWithConnID
func (hm *Manager) UntrackOperationWithConnID(seqID int64, connID uint64)
UntrackOperationWithConnID completes a MOVING operation with a specific connection ID.
MetricsHook
type MetricsHook struct {
NotificationCounts map[string]int64
ProcessingTimes map[string]time.Duration
ErrorCounts map[string]int64
HandoffCounts int64 // Total handoffs initiated
HandoffSuccesses int64 // Successful handoffs
HandoffFailures int64 // Failed handoffs
}
MetricsHook collects metrics about notification processing.
NewMetricsHook
func NewMetricsHook() *MetricsHook
NewMetricsHook creates a new metrics collection hook.
MetricsHook.GetMetrics
func (mh *MetricsHook) GetMetrics() map[string]interface{}
GetMetrics returns a summary of collected metrics.
MetricsHook.PostHook
func (mh *MetricsHook) PostHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error)
PostHook records processing completion and any errors.
MetricsHook.PreHook
func (mh *MetricsHook) PreHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}) ([]interface{}, bool)
PreHook records the start time for processing metrics.
Mode
type Mode string
Mode represents the maintenance notifications mode
ModeDisabled (3 declarations)
const ( ModeDisabled Mode = "disabled" // Client doesn't send CLIENT MAINT_NOTIFICATIONS ON command ModeEnabled Mode = "enabled" // Client forcefully sends command, interrupts connection on error ModeAuto Mode = "auto" // Client tries to send command, disables feature on error )
Constants for maintenance push notifications modes
Mode.IsValid
func (m Mode) IsValid() bool
IsValid returns true if the maintenance notifications mode is valid
Mode.String
func (m Mode) String() string
String returns the string representation of the mode
MovingOperation
type MovingOperation struct {
SeqID int64
NewEndpoint string
StartTime time.Time
Deadline time.Time
}
MovingOperation tracks an active MOVING operation.
MovingOperationKey
type MovingOperationKey struct {
SeqID int64 // Sequence ID from MOVING notification
ConnID uint64 // Unique connection identifier
}
MovingOperationKey provides a unique key for tracking MOVING operations that combines sequence ID with connection identifier to handle duplicate sequence IDs across multiple connections to the same node.
MovingOperationKey.String
func (k MovingOperationKey) String() string
String returns a string representation of the key for debugging
NotificationHandler
type NotificationHandler struct {
// contains filtered or unexported fields
}
NotificationHandler handles push notifications for the simplified manager.
NotificationHandler.HandlePushNotification
func (snh *NotificationHandler) HandlePushNotification(ctx context.Context, handlerCtx push.NotificationHandlerContext, notification []interface{}) error
HandlePushNotification processes push notifications with hook support.
NotificationHook
type NotificationHook interface {
PreHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}) ([]interface{}, bool)
PostHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error)
}
NotificationHook is called before and after notification processing PreHook can modify the notification and return false to skip processing PostHook is called after successful processing
OperationsManagerInterface
type OperationsManagerInterface interface {
TrackMovingOperationWithConnID(ctx context.Context, newEndpoint string, deadline time.Time, seqID int64, connID uint64) error
UntrackOperationWithConnID(seqID int64, connID uint64)
}
OperationsManagerInterface defines the interface for completing handoff operations
PoolHook
type PoolHook struct {
// contains filtered or unexported fields
}
PoolHook implements pool.PoolHook for Redis-specific connection handling with maintenance notifications support.
NewPoolHook
func NewPoolHook(baseDialer func(context.Context, string, string) (net.Conn, error), network string, config *Config, operationsManager OperationsManagerInterface) *PoolHook
NewPoolHook creates a new pool hook
NewPoolHookWithPoolSize
func NewPoolHookWithPoolSize(baseDialer func(context.Context, string, string) (net.Conn, error), network string, config *Config, operationsManager OperationsManagerInterface, poolSize int) *PoolHook
NewPoolHookWithPoolSize creates a new pool hook with pool size for better worker defaults
PoolHook.GetCircuitBreakerStats
func (ph *PoolHook) GetCircuitBreakerStats() []CircuitBreakerStats
GetCircuitBreakerStats returns circuit breaker statistics for monitoring
PoolHook.GetCurrentWorkers
func (ph *PoolHook) GetCurrentWorkers() int
GetCurrentWorkers returns the current number of active workers (for testing)
PoolHook.GetHandoffQueue
func (ph *PoolHook) GetHandoffQueue() chan HandoffRequest
GetHandoffQueue returns the handoff queue for testing purposes
PoolHook.GetMaxWorkers
func (ph *PoolHook) GetMaxWorkers() int
GetMaxWorkers returns the max workers for testing purposes
PoolHook.GetPendingMap
func (ph *PoolHook) GetPendingMap() *sync.Map
GetPendingMap returns the pending map for testing purposes
PoolHook.IsHandoffPending
func (ph *PoolHook) IsHandoffPending(conn *pool.Conn) bool
IsHandoffPending returns true if the given connection has a pending handoff
PoolHook.OnGet
func (ph *PoolHook) OnGet(_ context.Context, conn *pool.Conn, _ bool) (accept bool, err error)
OnGet is called when a connection is retrieved from the pool
PoolHook.OnPut
func (ph *PoolHook) OnPut(ctx context.Context, conn *pool.Conn) (shouldPool bool, shouldRemove bool, err error)
OnPut is called when a connection is returned to the pool
PoolHook.OnRemove
func (ph *PoolHook) OnRemove(_ context.Context, conn *pool.Conn, _ error)
PoolHook.ResetCircuitBreakers
func (ph *PoolHook) ResetCircuitBreakers()
ResetCircuitBreakers resets all circuit breakers (useful for testing)
PoolHook.SetPool
func (ph *PoolHook) SetPool(pooler pool.Pooler)
SetPool sets the pool interface for removing connections on handoff failure
PoolHook.Shutdown
func (ph *PoolHook) Shutdown(ctx context.Context) error
Shutdown gracefully shuts down the processor, waiting for workers to complete
State
type State int
State represents the current state of a maintenance operation
StateIdle (2 declarations)
const ( // StateIdle indicates no upgrade is in progress StateIdle State = iota // StateHandoff indicates a connection handoff is in progress StateMoving )
State.String
func (s State) String() string
String returns a string representation of the state.