1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

fix: simplify api

This commit is contained in:
Nedyalko Dyakov
2025-06-27 22:25:36 +03:00
parent f7948b5c5c
commit 3473c1e998
7 changed files with 26 additions and 1521 deletions

View File

@ -8,6 +8,7 @@ import (
"time"
"github.com/redis/go-redis/v9/internal/proto"
"github.com/redis/go-redis/v9/internal/pushnotif"
)
var noDeadline = time.Time{}
@ -27,8 +28,8 @@ type Conn struct {
onClose func() error
// Push notification processor for handling push notifications on this connection
// Uses the same interface as defined in pool.go to avoid duplication
PushNotificationProcessor PushNotificationProcessorInterface
// This is set when the connection is created and is a reference to the processor
PushNotificationProcessor pushnotif.ProcessorInterface
}
func NewConn(netConn net.Conn) *Conn {

View File

@ -9,7 +9,7 @@ import (
"time"
"github.com/redis/go-redis/v9/internal"
"github.com/redis/go-redis/v9/internal/proto"
"github.com/redis/go-redis/v9/internal/pushnotif"
)
var (
@ -24,8 +24,6 @@ var (
ErrPoolTimeout = errors.New("redis: connection pool timeout")
)
var timers = sync.Pool{
New: func() interface{} {
t := time.NewTimer(time.Hour)
@ -62,12 +60,6 @@ type Pooler interface {
Close() error
}
// PushNotificationProcessorInterface defines the interface for push notification processors.
// This matches the main PushNotificationProcessorInterface to avoid duplication while preventing circular imports.
type PushNotificationProcessorInterface interface {
ProcessPendingNotifications(ctx context.Context, rd *proto.Reader) error
}
type Options struct {
Dialer func(context.Context) (net.Conn, error)
@ -82,9 +74,8 @@ type Options struct {
ConnMaxLifetime time.Duration
// Push notification processor for connections
// This interface matches PushNotificationProcessorInterface to avoid duplication
// while preventing circular imports
PushNotificationProcessor PushNotificationProcessorInterface
// This is an interface to avoid circular imports
PushNotificationProcessor pushnotif.ProcessorInterface
// Protocol version for optimization (3 = RESP3 with push notifications, 2 = RESP2 without)
Protocol int