valkey-glide 1.3.4rc1__cp313-cp313-macosx_11_0_arm64.whl → 2.0.0rc6__cp313-cp313-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of valkey-glide might be problematic. Click here for more details.

Files changed (32) hide show
  1. glide/__init__.py +11 -7
  2. glide/async_commands/{transaction.py → batch.py} +1413 -987
  3. glide/async_commands/bitmap.py +94 -85
  4. glide/async_commands/cluster_commands.py +308 -123
  5. glide/async_commands/command_args.py +7 -6
  6. glide/async_commands/core.py +1304 -714
  7. glide/async_commands/server_modules/ft.py +83 -14
  8. glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +15 -8
  9. glide/async_commands/server_modules/ft_options/ft_create_options.py +23 -11
  10. glide/async_commands/server_modules/ft_options/ft_profile_options.py +12 -7
  11. glide/async_commands/server_modules/ft_options/ft_search_options.py +12 -6
  12. glide/async_commands/server_modules/glide_json.py +134 -43
  13. glide/async_commands/server_modules/json_batch.py +157 -127
  14. glide/async_commands/sorted_set.py +39 -29
  15. glide/async_commands/standalone_commands.py +199 -95
  16. glide/async_commands/stream.py +94 -87
  17. glide/config.py +165 -105
  18. glide/constants.py +8 -4
  19. glide/glide.cpython-313-darwin.so +0 -0
  20. glide/glide_client.py +273 -94
  21. glide/logger.py +1 -1
  22. glide/protobuf/command_request_pb2.py +15 -15
  23. glide/protobuf/command_request_pb2.pyi +69 -46
  24. glide/protobuf/connection_request_pb2.py +15 -13
  25. glide/protobuf/connection_request_pb2.pyi +57 -29
  26. glide/protobuf/response_pb2.pyi +8 -9
  27. glide/protobuf_codec.py +7 -6
  28. glide/routes.py +41 -8
  29. {valkey_glide-1.3.4rc1.dist-info → valkey_glide-2.0.0rc6.dist-info}/METADATA +29 -8
  30. valkey_glide-2.0.0rc6.dist-info/RECORD +37 -0
  31. valkey_glide-1.3.4rc1.dist-info/RECORD +0 -37
  32. {valkey_glide-1.3.4rc1.dist-info → valkey_glide-2.0.0rc6.dist-info}/WHEEL +0 -0
glide/config.py CHANGED
@@ -15,14 +15,15 @@ from glide.protobuf.connection_request_pb2 import TlsMode
15
15
 
16
16
 
17
17
  class NodeAddress:
18
- def __init__(self, host: str = "localhost", port: int = 6379):
19
- """
20
- Represents the address and port of a node in the cluster.
18
+ """
19
+ Represents the address and port of a node in the cluster.
21
20
 
22
- Args:
23
- host (str, optional): The server host. Defaults to "localhost".
24
- port (int, optional): The server port. Defaults to 6379.
25
- """
21
+ Attributes:
22
+ host (str, optional): The server host. Defaults to "localhost".
23
+ port (int, optional): The server port. Defaults to 6379.
24
+ """
25
+
26
+ def __init__(self, host: str = "localhost", port: int = 6379):
26
27
  self.host = host
27
28
  self.port = port
28
29
 
@@ -69,52 +70,64 @@ class ProtocolVersion(Enum):
69
70
 
70
71
 
71
72
  class BackoffStrategy:
72
- def __init__(self, num_of_retries: int, factor: int, exponent_base: int):
73
- """
74
- Represents the strategy used to determine how and when to reconnect, in case of connection failures.
75
- The time between attempts grows exponentially, to the formula rand(0 .. factor * (exponentBase ^ N)), where N
76
- is the number of failed attempts.
77
- Once the maximum value is reached, that will remain the time between retry attempts until a reconnect attempt is succesful.
78
- The client will attempt to reconnect indefinitely.
73
+ """
74
+ Represents the strategy used to determine how and when to reconnect, in case of connection failures.
75
+ The time between attempts grows exponentially, to the formula rand(0 .. factor * (exponentBase ^ N)), where N
76
+ is the number of failed attempts.
77
+ Once the maximum value is reached, that will remain the time between retry attempts until a reconnect attempt is
78
+ successful.
79
+ The client will attempt to reconnect indefinitely.
79
80
 
80
- Args:
81
- num_of_retries (int): Number of retry attempts that the client should perform when disconnected from the server,
82
- where the time between retries increases. Once the retries have reached the maximum value, the time between
83
- retries will remain constant until a reconnect attempt is succesful.
84
- factor (int): The multiplier that will be applied to the waiting time between each retry.
85
- exponent_base (int): The exponent base configured for the strategy.
86
- """
81
+ Attributes:
82
+ num_of_retries (int): Number of retry attempts that the client should perform when disconnected from the server,
83
+ where the time between retries increases. Once the retries have reached the maximum value, the time between
84
+ retries will remain constant until a reconnect attempt is succesful.
85
+ factor (int): The multiplier that will be applied to the waiting time between each retry.
86
+ exponent_base (int): The exponent base configured for the strategy.
87
+ jitter_percent (Optional[int]): The Jitter percent on the calculated duration. If not set, a default value will be used.
88
+ """
89
+
90
+ def __init__(
91
+ self,
92
+ num_of_retries: int,
93
+ factor: int,
94
+ exponent_base: int,
95
+ jitter_percent: Optional[int] = None,
96
+ ):
87
97
  self.num_of_retries = num_of_retries
88
98
  self.factor = factor
89
99
  self.exponent_base = exponent_base
100
+ self.jitter_percent = jitter_percent
90
101
 
91
102
 
92
103
  class ServerCredentials:
104
+ """
105
+ Represents the credentials for connecting to a server.
106
+
107
+ Attributes:
108
+ password (str): The password that will be used for authenticating connections to the servers.
109
+ username (Optional[str]): The username that will be used for authenticating connections to the servers.
110
+ If not supplied, "default" will be used.
111
+ """
112
+
93
113
  def __init__(
94
114
  self,
95
115
  password: str,
96
116
  username: Optional[str] = None,
97
117
  ):
98
- """
99
- Represents the credentials for connecting to a server.
100
-
101
- Args:
102
- password (str): The password that will be used for authenticating connections to the servers.
103
- username (Optional[str]): The username that will be used for authenticating connections to the servers.
104
- If not supplied, "default" will be used.
105
- """
106
118
  self.password = password
107
119
  self.username = username
108
120
 
109
121
 
110
122
  class PeriodicChecksManualInterval:
111
- def __init__(self, duration_in_sec: int) -> None:
112
- """
113
- Represents a manually configured interval for periodic checks.
123
+ """
124
+ Represents a manually configured interval for periodic checks.
114
125
 
115
- Args:
116
- duration_in_sec (int): The duration in seconds for the interval between periodic checks.
117
- """
126
+ Attributes:
127
+ duration_in_sec (int): The duration in seconds for the interval between periodic checks.
128
+ """
129
+
130
+ def __init__(self, duration_in_sec: int) -> None:
118
131
  self.duration_in_sec = duration_in_sec
119
132
 
120
133
 
@@ -138,7 +151,7 @@ class AdvancedBaseClientConfiguration:
138
151
  """
139
152
  Represents the advanced configuration settings for a base Glide client.
140
153
 
141
- Args:
154
+ Attributes:
142
155
  connection_timeout (Optional[int]): The duration in milliseconds to wait for a TCP/TLS connection to complete.
143
156
  This applies both during initial client creation and any reconnections that may occur during request processing.
144
157
  **Note**: A high connection timeout may lead to prolonged blocking of the entire command pipeline.
@@ -157,6 +170,52 @@ class AdvancedBaseClientConfiguration:
157
170
 
158
171
 
159
172
  class BaseClientConfiguration:
173
+ """
174
+ Represents the configuration settings for a Glide client.
175
+
176
+ Attributes:
177
+ addresses (List[NodeAddress]): DNS Addresses and ports of known nodes in the cluster.
178
+ If the server is in cluster mode the list can be partial, as the client will attempt to map out
179
+ the cluster and find all nodes.
180
+ If the server is in standalone mode, only nodes whose addresses were provided will be used by the
181
+ client.
182
+ For example::
183
+
184
+ [
185
+ {address:sample-address-0001.use1.cache.amazonaws.com, port:6379},
186
+ {address: sample-address-0002.use2.cache.amazonaws.com, port:6379}
187
+ ].
188
+
189
+ use_tls (bool): True if communication with the cluster should use Transport Level Security.
190
+ Should match the TLS configuration of the server/cluster, otherwise the connection attempt will fail
191
+ credentials (ServerCredentials): Credentials for authentication process.
192
+ If none are set, the client will not authenticate itself with the server.
193
+ read_from (ReadFrom): If not set, `PRIMARY` will be used.
194
+ request_timeout (Optional[int]): The duration in milliseconds that the client should wait for a request to
195
+ complete.
196
+ This duration encompasses sending the request, awaiting for a response from the server, and any required
197
+ reconnections or retries.
198
+ If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not
199
+ explicitly set, a default value of 250 milliseconds will be used.
200
+ reconnect_strategy (Optional[BackoffStrategy]): Strategy used to determine how and when to reconnect, in case of
201
+ connection failures.
202
+ If not set, a default backoff strategy will be used.
203
+ client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command
204
+ during connection establishment.
205
+ protocol (ProtocolVersion): Serialization protocol to be used. If not set, `RESP3` will be used.
206
+ inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight
207
+ (sent but not yet completed).
208
+ This limit is used to control the memory usage and prevent the client from overwhelming the server or getting
209
+ stuck in case of a queue backlog.
210
+ If not set, a default value will be used.
211
+ client_az (Optional[str]): Availability Zone of the client.
212
+ If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas
213
+ within the specified AZ if exits.
214
+ If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed
215
+ to nodes (first replicas then primary) within the specified AZ if they exist.
216
+ advanced_config (Optional[AdvancedBaseClientConfiguration]): Advanced configuration settings for the client.
217
+ """
218
+
160
219
  def __init__(
161
220
  self,
162
221
  addresses: List[NodeAddress],
@@ -164,49 +223,19 @@ class BaseClientConfiguration:
164
223
  credentials: Optional[ServerCredentials] = None,
165
224
  read_from: ReadFrom = ReadFrom.PRIMARY,
166
225
  request_timeout: Optional[int] = None,
226
+ reconnect_strategy: Optional[BackoffStrategy] = None,
167
227
  client_name: Optional[str] = None,
168
228
  protocol: ProtocolVersion = ProtocolVersion.RESP3,
169
229
  inflight_requests_limit: Optional[int] = None,
170
230
  client_az: Optional[str] = None,
171
231
  advanced_config: Optional[AdvancedBaseClientConfiguration] = None,
172
232
  ):
173
- """
174
- Represents the configuration settings for a Glide client.
175
-
176
- Args:
177
- addresses (List[NodeAddress]): DNS Addresses and ports of known nodes in the cluster.
178
- If the server is in cluster mode the list can be partial, as the client will attempt to map out
179
- the cluster and find all nodes.
180
- If the server is in standalone mode, only nodes whose addresses were provided will be used by the
181
- client.
182
- For example:
183
- [
184
- {address:sample-address-0001.use1.cache.amazonaws.com, port:6379},
185
- {address: sample-address-0002.use2.cache.amazonaws.com, port:6379}
186
- ].
187
- use_tls (bool): True if communication with the cluster should use Transport Level Security.
188
- Should match the TLS configuration of the server/cluster, otherwise the connection attempt will fail
189
- credentials (ServerCredentials): Credentials for authentication process.
190
- If none are set, the client will not authenticate itself with the server.
191
- read_from (ReadFrom): If not set, `PRIMARY` will be used.
192
- request_timeout (Optional[int]): The duration in milliseconds that the client should wait for a request to complete.
193
- This duration encompasses sending the request, awaiting for a response from the server, and any required reconnections or retries.
194
- If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used.
195
- client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment.
196
- protocol (ProtocolVersion): Serialization protocol to be used. If not set, `RESP3` will be used.
197
- inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).
198
- This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog.
199
- If not set, a default value will be used.
200
- client_az (Optional[str]): Availability Zone of the client.
201
- If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
202
- If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes (first replicas then primary) within the specified AZ if they exist.
203
- advanced_config (Optional[AdvancedBaseClientConfiguration]): Advanced configuration settings for the client.
204
- """
205
233
  self.addresses = addresses
206
234
  self.use_tls = use_tls
207
235
  self.credentials = credentials
208
236
  self.read_from = read_from
209
237
  self.request_timeout = request_timeout
238
+ self.reconnect_strategy = reconnect_strategy
210
239
  self.client_name = client_name
211
240
  self.protocol = protocol
212
241
  self.inflight_requests_limit = inflight_requests_limit
@@ -244,6 +273,19 @@ class BaseClientConfiguration:
244
273
  request.read_from = self.read_from.value
245
274
  if self.request_timeout:
246
275
  request.request_timeout = self.request_timeout
276
+ if self.reconnect_strategy:
277
+ request.connection_retry_strategy.number_of_retries = (
278
+ self.reconnect_strategy.num_of_retries
279
+ )
280
+ request.connection_retry_strategy.factor = self.reconnect_strategy.factor
281
+ request.connection_retry_strategy.exponent_base = (
282
+ self.reconnect_strategy.exponent_base
283
+ )
284
+ if self.reconnect_strategy.jitter_percent is not None:
285
+ request.connection_retry_strategy.jitter_percent = (
286
+ self.reconnect_strategy.jitter_percent
287
+ )
288
+
247
289
  request.cluster_mode_enabled = True if cluster_mode else False
248
290
  if self.credentials:
249
291
  if self.credentials.username:
@@ -284,43 +326,53 @@ class GlideClientConfiguration(BaseClientConfiguration):
284
326
  """
285
327
  Represents the configuration settings for a Standalone Glide client.
286
328
 
287
- Args:
329
+ Attributes:
288
330
  addresses (List[NodeAddress]): DNS Addresses and ports of known nodes in the cluster.
289
- Only nodes whose addresses were provided will be used by the client.
290
- For example:
331
+ Only nodes whose addresses were provided will be used by the client.
332
+ For example::
333
+
291
334
  [
292
335
  {address:sample-address-0001.use1.cache.amazonaws.com, port:6379},
293
336
  {address: sample-address-0002.use2.cache.amazonaws.com, port:6379}
294
- ].
337
+ ]
338
+
295
339
  use_tls (bool): True if communication with the cluster should use Transport Level Security.
296
340
  credentials (ServerCredentials): Credentials for authentication process.
297
341
  If none are set, the client will not authenticate itself with the server.
298
342
  read_from (ReadFrom): If not set, `PRIMARY` will be used.
299
343
  request_timeout (Optional[int]): The duration in milliseconds that the client should wait for a request to complete.
300
- This duration encompasses sending the request, awaiting for a response from the server, and any required reconnections or retries.
344
+ This duration encompasses sending the request, awaiting for a response from the server, and any required
345
+ reconnections or retries.
301
346
  If the specified timeout is exceeded for a pending request, it will result in a timeout error.
302
347
  If not explicitly set, a default value of 250 milliseconds will be used.
303
348
  reconnect_strategy (Optional[BackoffStrategy]): Strategy used to determine how and when to reconnect, in case of
304
349
  connection failures.
305
350
  If not set, a default backoff strategy will be used.
306
351
  database_id (Optional[int]): index of the logical database to connect to.
307
- client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment.
352
+ client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command during
353
+ connection establishment.
308
354
  protocol (ProtocolVersion): The version of the RESP protocol to communicate with the server.
309
- pubsub_subscriptions (Optional[GlideClientConfiguration.PubSubSubscriptions]): Pubsub subscriptions to be used for the client.
355
+ pubsub_subscriptions (Optional[GlideClientConfiguration.PubSubSubscriptions]): Pubsub subscriptions to be used for the
356
+ client.
310
357
  Will be applied via SUBSCRIBE/PSUBSCRIBE commands during connection establishment.
311
- inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).
312
- This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog.
358
+ inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight
359
+ (sent but not yet completed).
360
+ This limit is used to control the memory usage and prevent the client from overwhelming the server or getting
361
+ stuck in case of a queue backlog.
313
362
  If not set, a default value will be used.
314
363
  client_az (Optional[str]): Availability Zone of the client.
315
- If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
316
- If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes (first replicas then primary) within the specified AZ if they exist.
317
- advanced_config (Optional[AdvancedGlideClientConfiguration]): Advanced configuration settings for the client, see `AdvancedGlideClientConfiguration`.
364
+ If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within
365
+ the specified AZ if exits.
366
+ If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to
367
+ nodes (first replicas then primary) within the specified AZ if they exist.
368
+ advanced_config (Optional[AdvancedGlideClientConfiguration]): Advanced configuration settings for the client,
369
+ see `AdvancedGlideClientConfiguration`.
318
370
  """
319
371
 
320
372
  class PubSubChannelModes(IntEnum):
321
373
  """
322
374
  Describes pubsub subsciption modes.
323
- See https://valkey.io/docs/topics/pubsub/ for more details
375
+ See [valkey.io](https://valkey.io/docs/topics/pubsub/) for more details
324
376
  """
325
377
 
326
378
  Exact = 0
@@ -369,13 +421,13 @@ class GlideClientConfiguration(BaseClientConfiguration):
369
421
  credentials=credentials,
370
422
  read_from=read_from,
371
423
  request_timeout=request_timeout,
424
+ reconnect_strategy=reconnect_strategy,
372
425
  client_name=client_name,
373
426
  protocol=protocol,
374
427
  inflight_requests_limit=inflight_requests_limit,
375
428
  client_az=client_az,
376
429
  advanced_config=advanced_config,
377
430
  )
378
- self.reconnect_strategy = reconnect_strategy
379
431
  self.database_id = database_id
380
432
  self.pubsub_subscriptions = pubsub_subscriptions
381
433
 
@@ -384,14 +436,6 @@ class GlideClientConfiguration(BaseClientConfiguration):
384
436
  ) -> ConnectionRequest:
385
437
  assert cluster_mode is False
386
438
  request = super()._create_a_protobuf_conn_request(cluster_mode)
387
- if self.reconnect_strategy:
388
- request.connection_retry_strategy.number_of_retries = (
389
- self.reconnect_strategy.num_of_retries
390
- )
391
- request.connection_retry_strategy.factor = self.reconnect_strategy.factor
392
- request.connection_retry_strategy.exponent_base = (
393
- self.reconnect_strategy.exponent_base
394
- )
395
439
  if self.database_id:
396
440
  request.database_id = self.database_id
397
441
 
@@ -443,38 +487,52 @@ class GlideClusterClientConfiguration(BaseClientConfiguration):
443
487
  """
444
488
  Represents the configuration settings for a Cluster Glide client.
445
489
 
446
- Args:
490
+ Attributes:
447
491
  addresses (List[NodeAddress]): DNS Addresses and ports of known nodes in the cluster.
448
- The list can be partial, as the client will attempt to map out the cluster and find all nodes.
449
- For example:
492
+ The list can be partial, as the client will attempt to map out the cluster and find all nodes.
493
+ For example::
494
+
450
495
  [
451
496
  {address:configuration-endpoint.use1.cache.amazonaws.com, port:6379}
452
- ].
497
+ ]
498
+
453
499
  use_tls (bool): True if communication with the cluster should use Transport Level Security.
454
500
  credentials (ServerCredentials): Credentials for authentication process.
455
501
  If none are set, the client will not authenticate itself with the server.
456
502
  read_from (ReadFrom): If not set, `PRIMARY` will be used.
457
503
  request_timeout (Optional[int]): The duration in milliseconds that the client should wait for a request to complete.
458
- This duration encompasses sending the request, awaiting for a response from the server, and any required reconnections or retries.
459
- If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used.
460
- client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment.
504
+ This duration encompasses sending the request, awaiting for a response from the server, and any required
505
+ reconnections or retries.
506
+ If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly
507
+ set, a default value of 250 milliseconds will be used.
508
+ reconnect_strategy (Optional[BackoffStrategy]): Strategy used to determine how and when to reconnect, in case of
509
+ connection failures.
510
+ If not set, a default backoff strategy will be used.
511
+ client_name (Optional[str]): Client name to be used for the client. Will be used with CLIENT SETNAME command during
512
+ connection establishment.
461
513
  protocol (ProtocolVersion): The version of the RESP protocol to communicate with the server.
462
514
  periodic_checks (Union[PeriodicChecksStatus, PeriodicChecksManualInterval]): Configure the periodic topology checks.
463
515
  These checks evaluate changes in the cluster's topology, triggering a slot refresh when detected.
464
516
  Periodic checks ensure a quick and efficient process by querying a limited number of nodes.
465
517
  Defaults to PeriodicChecksStatus.ENABLED_DEFAULT_CONFIGS.
466
- pubsub_subscriptions (Optional[GlideClusterClientConfiguration.PubSubSubscriptions]): Pubsub subscriptions to be used for the client.
518
+ pubsub_subscriptions (Optional[GlideClusterClientConfiguration.PubSubSubscriptions]): Pubsub subscriptions to be used
519
+ for the client.
467
520
  Will be applied via SUBSCRIBE/PSUBSCRIBE/SSUBSCRIBE commands during connection establishment.
468
- inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).
469
- This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog.
521
+ inflight_requests_limit (Optional[int]): The maximum number of concurrent requests allowed to be in-flight
522
+ (sent but not yet completed).
523
+ This limit is used to control the memory usage and prevent the client from overwhelming the server or getting
524
+ stuck in case of a queue backlog.
470
525
  If not set, a default value will be used.
471
526
  client_az (Optional[str]): Availability Zone of the client.
472
- If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
473
- If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes (first replicas then primary) within the specified AZ if they exist.
474
- advanced_config (Optional[AdvancedGlideClusterClientConfiguration]) : Advanced configuration settings for the client, see `AdvancedGlideClusterClientConfiguration`.
527
+ If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within
528
+ the specified AZ if exits.
529
+ If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to
530
+ nodes (first replicas then primary) within the specified AZ if they exist.
531
+ advanced_config (Optional[AdvancedGlideClusterClientConfiguration]) : Advanced configuration settings for the client,
532
+ see `AdvancedGlideClusterClientConfiguration`.
475
533
 
476
534
 
477
- Notes:
535
+ Note:
478
536
  Currently, the reconnection strategy in cluster mode is not configurable, and exponential backoff
479
537
  with fixed values is used.
480
538
  """
@@ -482,7 +540,7 @@ class GlideClusterClientConfiguration(BaseClientConfiguration):
482
540
  class PubSubChannelModes(IntEnum):
483
541
  """
484
542
  Describes pubsub subsciption modes.
485
- See https://valkey.io/docs/topics/pubsub/ for more details
543
+ See [valkey.io](https://valkey.io/docs/topics/pubsub/) for more details
486
544
  """
487
545
 
488
546
  Exact = 0
@@ -518,6 +576,7 @@ class GlideClusterClientConfiguration(BaseClientConfiguration):
518
576
  credentials: Optional[ServerCredentials] = None,
519
577
  read_from: ReadFrom = ReadFrom.PRIMARY,
520
578
  request_timeout: Optional[int] = None,
579
+ reconnect_strategy: Optional[BackoffStrategy] = None,
521
580
  client_name: Optional[str] = None,
522
581
  protocol: ProtocolVersion = ProtocolVersion.RESP3,
523
582
  periodic_checks: Union[
@@ -534,6 +593,7 @@ class GlideClusterClientConfiguration(BaseClientConfiguration):
534
593
  credentials=credentials,
535
594
  read_from=read_from,
536
595
  request_timeout=request_timeout,
596
+ reconnect_strategy=reconnect_strategy,
537
597
  client_name=client_name,
538
598
  protocol=protocol,
539
599
  inflight_requests_limit=inflight_requests_limit,
glide/constants.py CHANGED
@@ -34,7 +34,8 @@ TSingleNodeRoute = Union[RandomNode, SlotKeyRoute, SlotIdRoute, ByAddressRoute]
34
34
  # When specifying legacy path (path doesn't start with `$`), response will be T
35
35
  # Otherwise, (when specifying JSONPath), response will be List[Optional[T]].
36
36
  #
37
- # TJsonResponse is designed to handle scenarios where some paths may not contain valid values, especially with JSONPath targeting multiple paths.
37
+ # TJsonResponse is designed to handle scenarios where some paths may not contain valid values, especially with JSONPath
38
+ # targeting multiple paths.
38
39
  # In such cases, the response may include None values, represented as `Optional[T]` in the list.
39
40
  # This type provides flexibility for commands where a subset of the paths may return None.
40
41
  #
@@ -44,13 +45,15 @@ TJsonResponse = Union[T, List[Optional[T]]]
44
45
  # When specifying legacy path (path doesn't start with `$`), response will be T
45
46
  # Otherwise, (when specifying JSONPath), response will be List[T].
46
47
  # This type represents the response format for commands that apply to every path and every type in a JSON document.
47
- # It covers both singular and multiple paths, ensuring that the command returns valid results for each matched path without None values.
48
+ # It covers both singular and multiple paths, ensuring that the command returns valid results for each matched path
49
+ # without None values.
48
50
  #
49
51
  # TJsonUniversalResponse is considered "universal" because it applies to every matched path and
50
52
  # guarantees valid, non-null results across all paths, covering both singular and multiple paths.
51
53
  # This type is used for commands that return results from all matched paths, ensuring that each
52
54
  # path contains meaningful values without None entries (unless it's part of the commands response).
53
- # It is typically used in scenarios where each target is expected to yield a valid response. For commands that are valid for all target types.
55
+ # It is typically used in scenarios where each target is expected to yield a valid response. For commands that are valid
56
+ # for all target types.
54
57
  #
55
58
  # For more information, see: https://redis.io/docs/data-types/json/path/ .
56
59
  TJsonUniversalResponse = Union[T, List[T]]
@@ -62,7 +65,8 @@ TFunctionListResponse = List[
62
65
  ]
63
66
  ]
64
67
  # Response for function stats command on a single node.
65
- # The response holds a map with 2 keys: Current running function / script and information about it, and the engines and the information about it.
68
+ # The response holds a map with 2 keys: Current running function / script and information about it, and the engines and
69
+ # the information about it.
66
70
  TFunctionStatsSingleNodeResponse = Mapping[
67
71
  bytes,
68
72
  Union[
Binary file