@@ -3,7 +3,6 @@ package redis
33import (
44 "context"
55 "errors"
6- "fmt"
76 "net"
87 "time"
98
@@ -23,11 +22,6 @@ func NewClientAdapter(client *baseClient) interfaces.ClientInterface {
2322 return & clientAdapter {client : client }
2423}
2524
26- // NewClusterClientAdapter creates a new client adapter for cluster Redis clients.
27- func NewClusterClientAdapter (client interface {}) interfaces.ClientInterface {
28- return & clusterClientAdapter {client : client }
29- }
30-
3125// clientAdapter adapts a Redis client to implement interfaces.ClientInterface.
3226type clientAdapter struct {
3327 client * baseClient
@@ -126,78 +120,6 @@ func (ca *connectionAdapter) ClearRelaxedTimeout() {
126120 ca .conn .ClearRelaxedTimeout ()
127121}
128122
129- // clusterClientAdapter adapts a cluster client to implement interfaces.ClientInterface.
130- type clusterClientAdapter struct {
131- client interface {}
132- }
133-
134- // GetOptions returns the client options.
135- func (cca * clusterClientAdapter ) GetOptions () interfaces.OptionsInterface {
136- // Return a mock options adapter for cluster clients
137- return & mockClusterOptionsAdapter {}
138- }
139-
140- // ExecuteCommand executes a command on the cluster client.
141- func (cca * clusterClientAdapter ) ExecuteCommand (ctx context.Context , cmd interface {}) error {
142- // Use reflection to call Process method on the cluster client
143- // This is a simplified implementation for the refactoring
144- return nil // Mock implementation
145- }
146-
147- // GetPushProcessor returns the cluster client's push notification processor.
148- func (cca * clusterClientAdapter ) GetPushProcessor () interfaces.NotificationProcessor {
149- // For cluster clients, return a mock processor since the actual implementation
150- // would be more complex and distributed across nodes
151- return & mockClusterPushProcessor {}
152- }
153-
154- // DialToEndpoint creates a connection to the specified endpoint for cluster clients.
155- func (cca * clusterClientAdapter ) DialToEndpoint (ctx context.Context , endpoint string ) (interface {}, error ) {
156- // For cluster clients, this would need to handle cluster-specific connection logic
157- // For now, return an error indicating this is not implemented for cluster clients
158- return nil , fmt .Errorf ("DialToEndpoint not implemented for cluster clients" )
159- }
160-
161- // mockClusterOptionsAdapter is a mock implementation for cluster options.
162- type mockClusterOptionsAdapter struct {}
163-
164- // GetReadTimeout returns the read timeout.
165- func (mcoa * mockClusterOptionsAdapter ) GetReadTimeout () time.Duration {
166- return 5 * time .Second
167- }
168-
169- // GetWriteTimeout returns the write timeout.
170- func (mcoa * mockClusterOptionsAdapter ) GetWriteTimeout () time.Duration {
171- return 3 * time .Second
172- }
173-
174- // GetAddr returns the connection address.
175- func (mcoa * mockClusterOptionsAdapter ) GetAddr () string {
176- return "localhost:6379"
177- }
178-
179- // IsTLSEnabled returns true if TLS is enabled.
180- func (mcoa * mockClusterOptionsAdapter ) IsTLSEnabled () bool {
181- return false
182- }
183-
184- // GetProtocol returns the protocol version.
185- func (mcoa * mockClusterOptionsAdapter ) GetProtocol () int {
186- return 3
187- }
188-
189- // GetPoolSize returns the connection pool size.
190- func (mcoa * mockClusterOptionsAdapter ) GetPoolSize () int {
191- return 50 // Default cluster pool size (5 * runtime.GOMAXPROCS(0))
192- }
193-
194- // NewDialer returns a new dialer function for the connection.
195- func (mcoa * mockClusterOptionsAdapter ) NewDialer () func (context.Context ) (net.Conn , error ) {
196- return func (ctx context.Context ) (net.Conn , error ) {
197- return nil , errors .New ("mock cluster dialer" )
198- }
199- }
200-
201123// pushProcessorAdapter adapts a push.NotificationProcessor to implement interfaces.NotificationProcessor.
202124type pushProcessorAdapter struct {
203125 processor push.NotificationProcessor
@@ -220,21 +142,3 @@ func (ppa *pushProcessorAdapter) UnregisterHandler(pushNotificationName string)
220142func (ppa * pushProcessorAdapter ) GetHandler (pushNotificationName string ) interface {} {
221143 return ppa .processor .GetHandler (pushNotificationName )
222144}
223-
224- // mockClusterPushProcessor is a mock implementation for cluster push processors.
225- type mockClusterPushProcessor struct {}
226-
227- // RegisterHandler registers a handler (mock implementation).
228- func (mcpp * mockClusterPushProcessor ) RegisterHandler (pushNotificationName string , handler interface {}, protected bool ) error {
229- return nil
230- }
231-
232- // UnregisterHandler removes a handler (mock implementation).
233- func (mcpp * mockClusterPushProcessor ) UnregisterHandler (pushNotificationName string ) error {
234- return nil
235- }
236-
237- // GetHandler returns the handler (mock implementation).
238- func (mcpp * mockClusterPushProcessor ) GetHandler (pushNotificationName string ) interface {} {
239- return nil
240- }
0 commit comments