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:
@ -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 {
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user