valkey-glide 1.3.5__cp39-cp39-macosx_11_0_arm64.whl → 2.2.2__cp39-cp39-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.
Files changed (47) hide show
  1. glide/__init__.py +165 -107
  2. glide/async_commands/cluster_commands.py +318 -136
  3. glide/async_commands/core.py +1770 -992
  4. glide/async_commands/{server_modules/ft.py → ft.py} +91 -21
  5. glide/async_commands/{server_modules/glide_json.py → glide_json.py} +148 -134
  6. glide/async_commands/standalone_commands.py +203 -137
  7. glide/glide.cpython-39-darwin.so +0 -0
  8. glide/glide.pyi +26 -1
  9. glide/glide_client.py +352 -135
  10. glide/logger.py +34 -22
  11. glide/opentelemetry.py +185 -0
  12. glide_shared/__init__.py +330 -0
  13. glide_shared/commands/__init__.py +0 -0
  14. glide/async_commands/transaction.py → glide_shared/commands/batch.py +1839 -1017
  15. glide_shared/commands/batch_options.py +261 -0
  16. {glide/async_commands → glide_shared/commands}/bitmap.py +94 -85
  17. {glide/async_commands → glide_shared/commands}/command_args.py +7 -6
  18. glide_shared/commands/core_options.py +407 -0
  19. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_aggregate_options.py +18 -11
  20. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_create_options.py +27 -13
  21. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_profile_options.py +16 -11
  22. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_search_options.py +16 -8
  23. {glide/async_commands → glide_shared/commands}/server_modules/json_batch.py +160 -130
  24. glide_shared/commands/server_modules/json_options.py +93 -0
  25. {glide/async_commands → glide_shared/commands}/sorted_set.py +41 -31
  26. {glide/async_commands → glide_shared/commands}/stream.py +95 -88
  27. glide_shared/config.py +975 -0
  28. {glide → glide_shared}/constants.py +11 -7
  29. {glide → glide_shared}/exceptions.py +27 -1
  30. glide_shared/protobuf/command_request_pb2.py +56 -0
  31. glide_shared/protobuf/connection_request_pb2.py +56 -0
  32. {glide → glide_shared}/protobuf/response_pb2.py +6 -6
  33. {glide → glide_shared}/protobuf_codec.py +7 -6
  34. glide_shared/routes.py +161 -0
  35. valkey_glide-2.2.2.dist-info/METADATA +211 -0
  36. valkey_glide-2.2.2.dist-info/RECORD +40 -0
  37. glide/config.py +0 -590
  38. glide/protobuf/command_request_pb2.py +0 -54
  39. glide/protobuf/command_request_pb2.pyi +0 -1164
  40. glide/protobuf/connection_request_pb2.py +0 -52
  41. glide/protobuf/connection_request_pb2.pyi +0 -292
  42. glide/protobuf/response_pb2.pyi +0 -101
  43. glide/routes.py +0 -114
  44. valkey_glide-1.3.5.dist-info/METADATA +0 -125
  45. valkey_glide-1.3.5.dist-info/RECORD +0 -37
  46. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_constants.py +0 -0
  47. {valkey_glide-1.3.5.dist-info → valkey_glide-2.2.2.dist-info}/WHEEL +0 -0
@@ -1,52 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # source: protobuf/connection_request.proto
4
- # Protobuf Python Version: 4.25.1
5
- """Generated protocol buffer code."""
6
- from google.protobuf import descriptor as _descriptor
7
- from google.protobuf import descriptor_pool as _descriptor_pool
8
- from google.protobuf import symbol_database as _symbol_database
9
- from google.protobuf.internal import builder as _builder
10
- # @@protoc_insertion_point(imports)
11
-
12
- _sym_db = _symbol_database.Default()
13
-
14
-
15
-
16
-
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!protobuf/connection_request.proto\x12\x12\x63onnection_request\")\n\x0bNodeAddress\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\r\"8\n\x12\x41uthenticationInfo\x12\x10\n\x08password\x18\x01 \x01(\t\x12\x10\n\x08username\x18\x02 \x01(\t\"7\n\x1cPeriodicChecksManualInterval\x12\x17\n\x0f\x64uration_in_sec\x18\x01 \x01(\r\"\x18\n\x16PeriodicChecksDisabled\"8\n\x18PubSubChannelsOrPatterns\x12\x1c\n\x14\x63hannels_or_patterns\x18\x01 \x03(\x0c\"\xf1\x01\n\x13PubSubSubscriptions\x12k\n\x1c\x63hannels_or_patterns_by_type\x18\x01 \x03(\x0b\x32\x45.connection_request.PubSubSubscriptions.ChannelsOrPatternsByTypeEntry\x1am\n\x1d\x43hannelsOrPatternsByTypeEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.connection_request.PubSubChannelsOrPatterns:\x02\x38\x01\"\xab\x06\n\x11\x43onnectionRequest\x12\x32\n\taddresses\x18\x01 \x03(\x0b\x32\x1f.connection_request.NodeAddress\x12-\n\x08tls_mode\x18\x02 \x01(\x0e\x32\x1b.connection_request.TlsMode\x12\x1c\n\x14\x63luster_mode_enabled\x18\x03 \x01(\x08\x12\x17\n\x0frequest_timeout\x18\x04 \x01(\r\x12/\n\tread_from\x18\x05 \x01(\x0e\x32\x1c.connection_request.ReadFrom\x12N\n\x19\x63onnection_retry_strategy\x18\x06 \x01(\x0b\x32+.connection_request.ConnectionRetryStrategy\x12\x43\n\x13\x61uthentication_info\x18\x07 \x01(\x0b\x32&.connection_request.AuthenticationInfo\x12\x13\n\x0b\x64\x61tabase_id\x18\x08 \x01(\r\x12\x35\n\x08protocol\x18\t \x01(\x0e\x32#.connection_request.ProtocolVersion\x12\x13\n\x0b\x63lient_name\x18\n \x01(\t\x12[\n\x1fperiodic_checks_manual_interval\x18\x0b \x01(\x0b\x32\x30.connection_request.PeriodicChecksManualIntervalH\x00\x12N\n\x18periodic_checks_disabled\x18\x0c \x01(\x0b\x32*.connection_request.PeriodicChecksDisabledH\x00\x12\x45\n\x14pubsub_subscriptions\x18\r \x01(\x0b\x32\'.connection_request.PubSubSubscriptions\x12\x1f\n\x17inflight_requests_limit\x18\x0e \x01(\r\x12\x11\n\tclient_az\x18\x0f \x01(\t\x12\x1a\n\x12\x63onnection_timeout\x18\x10 \x01(\rB\x11\n\x0fperiodic_checks\"[\n\x17\x43onnectionRetryStrategy\x12\x19\n\x11number_of_retries\x18\x01 \x01(\r\x12\x0e\n\x06\x66\x61\x63tor\x18\x02 \x01(\r\x12\x15\n\rexponent_base\x18\x03 \x01(\r*o\n\x08ReadFrom\x12\x0b\n\x07Primary\x10\x00\x12\x11\n\rPreferReplica\x10\x01\x12\x11\n\rLowestLatency\x10\x02\x12\x0e\n\nAZAffinity\x10\x03\x12 \n\x1c\x41ZAffinityReplicasAndPrimary\x10\x04*4\n\x07TlsMode\x12\t\n\x05NoTls\x10\x00\x12\r\n\tSecureTls\x10\x01\x12\x0f\n\x0bInsecureTls\x10\x02*\'\n\x0fProtocolVersion\x12\t\n\x05RESP3\x10\x00\x12\t\n\x05RESP2\x10\x01*8\n\x11PubSubChannelType\x12\t\n\x05\x45xact\x10\x00\x12\x0b\n\x07Pattern\x10\x01\x12\x0b\n\x07Sharded\x10\x02\x62\x06proto3')
18
-
19
- _globals = globals()
20
- _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
- _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'protobuf.connection_request_pb2', _globals)
22
- if _descriptor._USE_C_DESCRIPTORS == False:
23
- DESCRIPTOR._options = None
24
- _globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._options = None
25
- _globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._serialized_options = b'8\001'
26
- _globals['_READFROM']._serialized_start=1450
27
- _globals['_READFROM']._serialized_end=1561
28
- _globals['_TLSMODE']._serialized_start=1563
29
- _globals['_TLSMODE']._serialized_end=1615
30
- _globals['_PROTOCOLVERSION']._serialized_start=1617
31
- _globals['_PROTOCOLVERSION']._serialized_end=1656
32
- _globals['_PUBSUBCHANNELTYPE']._serialized_start=1658
33
- _globals['_PUBSUBCHANNELTYPE']._serialized_end=1714
34
- _globals['_NODEADDRESS']._serialized_start=57
35
- _globals['_NODEADDRESS']._serialized_end=98
36
- _globals['_AUTHENTICATIONINFO']._serialized_start=100
37
- _globals['_AUTHENTICATIONINFO']._serialized_end=156
38
- _globals['_PERIODICCHECKSMANUALINTERVAL']._serialized_start=158
39
- _globals['_PERIODICCHECKSMANUALINTERVAL']._serialized_end=213
40
- _globals['_PERIODICCHECKSDISABLED']._serialized_start=215
41
- _globals['_PERIODICCHECKSDISABLED']._serialized_end=239
42
- _globals['_PUBSUBCHANNELSORPATTERNS']._serialized_start=241
43
- _globals['_PUBSUBCHANNELSORPATTERNS']._serialized_end=297
44
- _globals['_PUBSUBSUBSCRIPTIONS']._serialized_start=300
45
- _globals['_PUBSUBSUBSCRIPTIONS']._serialized_end=541
46
- _globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._serialized_start=432
47
- _globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._serialized_end=541
48
- _globals['_CONNECTIONREQUEST']._serialized_start=544
49
- _globals['_CONNECTIONREQUEST']._serialized_end=1355
50
- _globals['_CONNECTIONRETRYSTRATEGY']._serialized_start=1357
51
- _globals['_CONNECTIONRETRYSTRATEGY']._serialized_end=1448
52
- # @@protoc_insertion_point(module_scope)
@@ -1,292 +0,0 @@
1
- """
2
- @generated by mypy-protobuf. Do not edit manually!
3
- isort:skip_file
4
- """
5
-
6
- import builtins
7
- import collections.abc
8
- import google.protobuf.descriptor
9
- import google.protobuf.internal.containers
10
- import google.protobuf.internal.enum_type_wrapper
11
- import google.protobuf.message
12
- import sys
13
- import typing
14
-
15
- if sys.version_info >= (3, 10):
16
- import typing as typing_extensions
17
- else:
18
- import typing_extensions
19
-
20
- DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
21
-
22
- class _ReadFrom:
23
- ValueType = typing.NewType("ValueType", builtins.int)
24
- V: typing_extensions.TypeAlias = ValueType
25
-
26
- class _ReadFromEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ReadFrom.ValueType], builtins.type):
27
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
28
- Primary: _ReadFrom.ValueType # 0
29
- PreferReplica: _ReadFrom.ValueType # 1
30
- LowestLatency: _ReadFrom.ValueType # 2
31
- AZAffinity: _ReadFrom.ValueType # 3
32
- AZAffinityReplicasAndPrimary: _ReadFrom.ValueType # 4
33
-
34
- class ReadFrom(_ReadFrom, metaclass=_ReadFromEnumTypeWrapper): ...
35
-
36
- Primary: ReadFrom.ValueType # 0
37
- PreferReplica: ReadFrom.ValueType # 1
38
- LowestLatency: ReadFrom.ValueType # 2
39
- AZAffinity: ReadFrom.ValueType # 3
40
- AZAffinityReplicasAndPrimary: ReadFrom.ValueType # 4
41
- global___ReadFrom = ReadFrom
42
-
43
- class _TlsMode:
44
- ValueType = typing.NewType("ValueType", builtins.int)
45
- V: typing_extensions.TypeAlias = ValueType
46
-
47
- class _TlsModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_TlsMode.ValueType], builtins.type):
48
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
49
- NoTls: _TlsMode.ValueType # 0
50
- SecureTls: _TlsMode.ValueType # 1
51
- InsecureTls: _TlsMode.ValueType # 2
52
-
53
- class TlsMode(_TlsMode, metaclass=_TlsModeEnumTypeWrapper): ...
54
-
55
- NoTls: TlsMode.ValueType # 0
56
- SecureTls: TlsMode.ValueType # 1
57
- InsecureTls: TlsMode.ValueType # 2
58
- global___TlsMode = TlsMode
59
-
60
- class _ProtocolVersion:
61
- ValueType = typing.NewType("ValueType", builtins.int)
62
- V: typing_extensions.TypeAlias = ValueType
63
-
64
- class _ProtocolVersionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ProtocolVersion.ValueType], builtins.type):
65
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
66
- RESP3: _ProtocolVersion.ValueType # 0
67
- RESP2: _ProtocolVersion.ValueType # 1
68
-
69
- class ProtocolVersion(_ProtocolVersion, metaclass=_ProtocolVersionEnumTypeWrapper): ...
70
-
71
- RESP3: ProtocolVersion.ValueType # 0
72
- RESP2: ProtocolVersion.ValueType # 1
73
- global___ProtocolVersion = ProtocolVersion
74
-
75
- class _PubSubChannelType:
76
- ValueType = typing.NewType("ValueType", builtins.int)
77
- V: typing_extensions.TypeAlias = ValueType
78
-
79
- class _PubSubChannelTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_PubSubChannelType.ValueType], builtins.type):
80
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
81
- Exact: _PubSubChannelType.ValueType # 0
82
- Pattern: _PubSubChannelType.ValueType # 1
83
- Sharded: _PubSubChannelType.ValueType # 2
84
-
85
- class PubSubChannelType(_PubSubChannelType, metaclass=_PubSubChannelTypeEnumTypeWrapper): ...
86
-
87
- Exact: PubSubChannelType.ValueType # 0
88
- Pattern: PubSubChannelType.ValueType # 1
89
- Sharded: PubSubChannelType.ValueType # 2
90
- global___PubSubChannelType = PubSubChannelType
91
-
92
- @typing.final
93
- class NodeAddress(google.protobuf.message.Message):
94
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
95
-
96
- HOST_FIELD_NUMBER: builtins.int
97
- PORT_FIELD_NUMBER: builtins.int
98
- host: builtins.str
99
- port: builtins.int
100
- def __init__(
101
- self,
102
- *,
103
- host: builtins.str = ...,
104
- port: builtins.int = ...,
105
- ) -> None: ...
106
- def ClearField(self, field_name: typing.Literal["host", b"host", "port", b"port"]) -> None: ...
107
-
108
- global___NodeAddress = NodeAddress
109
-
110
- @typing.final
111
- class AuthenticationInfo(google.protobuf.message.Message):
112
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
113
-
114
- PASSWORD_FIELD_NUMBER: builtins.int
115
- USERNAME_FIELD_NUMBER: builtins.int
116
- password: builtins.str
117
- username: builtins.str
118
- def __init__(
119
- self,
120
- *,
121
- password: builtins.str = ...,
122
- username: builtins.str = ...,
123
- ) -> None: ...
124
- def ClearField(self, field_name: typing.Literal["password", b"password", "username", b"username"]) -> None: ...
125
-
126
- global___AuthenticationInfo = AuthenticationInfo
127
-
128
- @typing.final
129
- class PeriodicChecksManualInterval(google.protobuf.message.Message):
130
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
131
-
132
- DURATION_IN_SEC_FIELD_NUMBER: builtins.int
133
- duration_in_sec: builtins.int
134
- def __init__(
135
- self,
136
- *,
137
- duration_in_sec: builtins.int = ...,
138
- ) -> None: ...
139
- def ClearField(self, field_name: typing.Literal["duration_in_sec", b"duration_in_sec"]) -> None: ...
140
-
141
- global___PeriodicChecksManualInterval = PeriodicChecksManualInterval
142
-
143
- @typing.final
144
- class PeriodicChecksDisabled(google.protobuf.message.Message):
145
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
146
-
147
- def __init__(
148
- self,
149
- ) -> None: ...
150
-
151
- global___PeriodicChecksDisabled = PeriodicChecksDisabled
152
-
153
- @typing.final
154
- class PubSubChannelsOrPatterns(google.protobuf.message.Message):
155
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
156
-
157
- CHANNELS_OR_PATTERNS_FIELD_NUMBER: builtins.int
158
- @property
159
- def channels_or_patterns(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: ...
160
- def __init__(
161
- self,
162
- *,
163
- channels_or_patterns: collections.abc.Iterable[builtins.bytes] | None = ...,
164
- ) -> None: ...
165
- def ClearField(self, field_name: typing.Literal["channels_or_patterns", b"channels_or_patterns"]) -> None: ...
166
-
167
- global___PubSubChannelsOrPatterns = PubSubChannelsOrPatterns
168
-
169
- @typing.final
170
- class PubSubSubscriptions(google.protobuf.message.Message):
171
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
172
-
173
- @typing.final
174
- class ChannelsOrPatternsByTypeEntry(google.protobuf.message.Message):
175
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
176
-
177
- KEY_FIELD_NUMBER: builtins.int
178
- VALUE_FIELD_NUMBER: builtins.int
179
- key: builtins.int
180
- @property
181
- def value(self) -> global___PubSubChannelsOrPatterns: ...
182
- def __init__(
183
- self,
184
- *,
185
- key: builtins.int = ...,
186
- value: global___PubSubChannelsOrPatterns | None = ...,
187
- ) -> None: ...
188
- def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ...
189
- def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ...
190
-
191
- CHANNELS_OR_PATTERNS_BY_TYPE_FIELD_NUMBER: builtins.int
192
- @property
193
- def channels_or_patterns_by_type(self) -> google.protobuf.internal.containers.MessageMap[builtins.int, global___PubSubChannelsOrPatterns]: ...
194
- def __init__(
195
- self,
196
- *,
197
- channels_or_patterns_by_type: collections.abc.Mapping[builtins.int, global___PubSubChannelsOrPatterns] | None = ...,
198
- ) -> None: ...
199
- def ClearField(self, field_name: typing.Literal["channels_or_patterns_by_type", b"channels_or_patterns_by_type"]) -> None: ...
200
-
201
- global___PubSubSubscriptions = PubSubSubscriptions
202
-
203
- @typing.final
204
- class ConnectionRequest(google.protobuf.message.Message):
205
- """IMPORTANT - if you add fields here, you probably need to add them also in client/mod.rs:`sanitized_request_string`."""
206
-
207
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
208
-
209
- ADDRESSES_FIELD_NUMBER: builtins.int
210
- TLS_MODE_FIELD_NUMBER: builtins.int
211
- CLUSTER_MODE_ENABLED_FIELD_NUMBER: builtins.int
212
- REQUEST_TIMEOUT_FIELD_NUMBER: builtins.int
213
- READ_FROM_FIELD_NUMBER: builtins.int
214
- CONNECTION_RETRY_STRATEGY_FIELD_NUMBER: builtins.int
215
- AUTHENTICATION_INFO_FIELD_NUMBER: builtins.int
216
- DATABASE_ID_FIELD_NUMBER: builtins.int
217
- PROTOCOL_FIELD_NUMBER: builtins.int
218
- CLIENT_NAME_FIELD_NUMBER: builtins.int
219
- PERIODIC_CHECKS_MANUAL_INTERVAL_FIELD_NUMBER: builtins.int
220
- PERIODIC_CHECKS_DISABLED_FIELD_NUMBER: builtins.int
221
- PUBSUB_SUBSCRIPTIONS_FIELD_NUMBER: builtins.int
222
- INFLIGHT_REQUESTS_LIMIT_FIELD_NUMBER: builtins.int
223
- CLIENT_AZ_FIELD_NUMBER: builtins.int
224
- CONNECTION_TIMEOUT_FIELD_NUMBER: builtins.int
225
- tls_mode: global___TlsMode.ValueType
226
- cluster_mode_enabled: builtins.bool
227
- request_timeout: builtins.int
228
- read_from: global___ReadFrom.ValueType
229
- database_id: builtins.int
230
- protocol: global___ProtocolVersion.ValueType
231
- client_name: builtins.str
232
- inflight_requests_limit: builtins.int
233
- client_az: builtins.str
234
- connection_timeout: builtins.int
235
- @property
236
- def addresses(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NodeAddress]: ...
237
- @property
238
- def connection_retry_strategy(self) -> global___ConnectionRetryStrategy: ...
239
- @property
240
- def authentication_info(self) -> global___AuthenticationInfo: ...
241
- @property
242
- def periodic_checks_manual_interval(self) -> global___PeriodicChecksManualInterval: ...
243
- @property
244
- def periodic_checks_disabled(self) -> global___PeriodicChecksDisabled: ...
245
- @property
246
- def pubsub_subscriptions(self) -> global___PubSubSubscriptions: ...
247
- def __init__(
248
- self,
249
- *,
250
- addresses: collections.abc.Iterable[global___NodeAddress] | None = ...,
251
- tls_mode: global___TlsMode.ValueType = ...,
252
- cluster_mode_enabled: builtins.bool = ...,
253
- request_timeout: builtins.int = ...,
254
- read_from: global___ReadFrom.ValueType = ...,
255
- connection_retry_strategy: global___ConnectionRetryStrategy | None = ...,
256
- authentication_info: global___AuthenticationInfo | None = ...,
257
- database_id: builtins.int = ...,
258
- protocol: global___ProtocolVersion.ValueType = ...,
259
- client_name: builtins.str = ...,
260
- periodic_checks_manual_interval: global___PeriodicChecksManualInterval | None = ...,
261
- periodic_checks_disabled: global___PeriodicChecksDisabled | None = ...,
262
- pubsub_subscriptions: global___PubSubSubscriptions | None = ...,
263
- inflight_requests_limit: builtins.int = ...,
264
- client_az: builtins.str = ...,
265
- connection_timeout: builtins.int = ...,
266
- ) -> None: ...
267
- def HasField(self, field_name: typing.Literal["authentication_info", b"authentication_info", "connection_retry_strategy", b"connection_retry_strategy", "periodic_checks", b"periodic_checks", "periodic_checks_disabled", b"periodic_checks_disabled", "periodic_checks_manual_interval", b"periodic_checks_manual_interval", "pubsub_subscriptions", b"pubsub_subscriptions"]) -> builtins.bool: ...
268
- def ClearField(self, field_name: typing.Literal["addresses", b"addresses", "authentication_info", b"authentication_info", "client_az", b"client_az", "client_name", b"client_name", "cluster_mode_enabled", b"cluster_mode_enabled", "connection_retry_strategy", b"connection_retry_strategy", "connection_timeout", b"connection_timeout", "database_id", b"database_id", "inflight_requests_limit", b"inflight_requests_limit", "periodic_checks", b"periodic_checks", "periodic_checks_disabled", b"periodic_checks_disabled", "periodic_checks_manual_interval", b"periodic_checks_manual_interval", "protocol", b"protocol", "pubsub_subscriptions", b"pubsub_subscriptions", "read_from", b"read_from", "request_timeout", b"request_timeout", "tls_mode", b"tls_mode"]) -> None: ...
269
- def WhichOneof(self, oneof_group: typing.Literal["periodic_checks", b"periodic_checks"]) -> typing.Literal["periodic_checks_manual_interval", "periodic_checks_disabled"] | None: ...
270
-
271
- global___ConnectionRequest = ConnectionRequest
272
-
273
- @typing.final
274
- class ConnectionRetryStrategy(google.protobuf.message.Message):
275
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
276
-
277
- NUMBER_OF_RETRIES_FIELD_NUMBER: builtins.int
278
- FACTOR_FIELD_NUMBER: builtins.int
279
- EXPONENT_BASE_FIELD_NUMBER: builtins.int
280
- number_of_retries: builtins.int
281
- factor: builtins.int
282
- exponent_base: builtins.int
283
- def __init__(
284
- self,
285
- *,
286
- number_of_retries: builtins.int = ...,
287
- factor: builtins.int = ...,
288
- exponent_base: builtins.int = ...,
289
- ) -> None: ...
290
- def ClearField(self, field_name: typing.Literal["exponent_base", b"exponent_base", "factor", b"factor", "number_of_retries", b"number_of_retries"]) -> None: ...
291
-
292
- global___ConnectionRetryStrategy = ConnectionRetryStrategy
@@ -1,101 +0,0 @@
1
- """
2
- @generated by mypy-protobuf. Do not edit manually!
3
- isort:skip_file
4
- """
5
-
6
- import builtins
7
- import google.protobuf.descriptor
8
- import google.protobuf.internal.enum_type_wrapper
9
- import google.protobuf.message
10
- import sys
11
- import typing
12
-
13
- if sys.version_info >= (3, 10):
14
- import typing as typing_extensions
15
- else:
16
- import typing_extensions
17
-
18
- DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
19
-
20
- class _RequestErrorType:
21
- ValueType = typing.NewType("ValueType", builtins.int)
22
- V: typing_extensions.TypeAlias = ValueType
23
-
24
- class _RequestErrorTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_RequestErrorType.ValueType], builtins.type):
25
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
26
- Unspecified: _RequestErrorType.ValueType # 0
27
- ExecAbort: _RequestErrorType.ValueType # 1
28
- Timeout: _RequestErrorType.ValueType # 2
29
- Disconnect: _RequestErrorType.ValueType # 3
30
-
31
- class RequestErrorType(_RequestErrorType, metaclass=_RequestErrorTypeEnumTypeWrapper): ...
32
-
33
- Unspecified: RequestErrorType.ValueType # 0
34
- ExecAbort: RequestErrorType.ValueType # 1
35
- Timeout: RequestErrorType.ValueType # 2
36
- Disconnect: RequestErrorType.ValueType # 3
37
- global___RequestErrorType = RequestErrorType
38
-
39
- class _ConstantResponse:
40
- ValueType = typing.NewType("ValueType", builtins.int)
41
- V: typing_extensions.TypeAlias = ValueType
42
-
43
- class _ConstantResponseEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ConstantResponse.ValueType], builtins.type):
44
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
45
- OK: _ConstantResponse.ValueType # 0
46
-
47
- class ConstantResponse(_ConstantResponse, metaclass=_ConstantResponseEnumTypeWrapper): ...
48
-
49
- OK: ConstantResponse.ValueType # 0
50
- global___ConstantResponse = ConstantResponse
51
-
52
- @typing.final
53
- class RequestError(google.protobuf.message.Message):
54
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
55
-
56
- TYPE_FIELD_NUMBER: builtins.int
57
- MESSAGE_FIELD_NUMBER: builtins.int
58
- type: global___RequestErrorType.ValueType
59
- message: builtins.str
60
- def __init__(
61
- self,
62
- *,
63
- type: global___RequestErrorType.ValueType = ...,
64
- message: builtins.str = ...,
65
- ) -> None: ...
66
- def ClearField(self, field_name: typing.Literal["message", b"message", "type", b"type"]) -> None: ...
67
-
68
- global___RequestError = RequestError
69
-
70
- @typing.final
71
- class Response(google.protobuf.message.Message):
72
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
73
-
74
- CALLBACK_IDX_FIELD_NUMBER: builtins.int
75
- RESP_POINTER_FIELD_NUMBER: builtins.int
76
- CONSTANT_RESPONSE_FIELD_NUMBER: builtins.int
77
- REQUEST_ERROR_FIELD_NUMBER: builtins.int
78
- CLOSING_ERROR_FIELD_NUMBER: builtins.int
79
- IS_PUSH_FIELD_NUMBER: builtins.int
80
- callback_idx: builtins.int
81
- resp_pointer: builtins.int
82
- constant_response: global___ConstantResponse.ValueType
83
- closing_error: builtins.str
84
- is_push: builtins.bool
85
- @property
86
- def request_error(self) -> global___RequestError: ...
87
- def __init__(
88
- self,
89
- *,
90
- callback_idx: builtins.int = ...,
91
- resp_pointer: builtins.int = ...,
92
- constant_response: global___ConstantResponse.ValueType = ...,
93
- request_error: global___RequestError | None = ...,
94
- closing_error: builtins.str = ...,
95
- is_push: builtins.bool = ...,
96
- ) -> None: ...
97
- def HasField(self, field_name: typing.Literal["closing_error", b"closing_error", "constant_response", b"constant_response", "request_error", b"request_error", "resp_pointer", b"resp_pointer", "value", b"value"]) -> builtins.bool: ...
98
- def ClearField(self, field_name: typing.Literal["callback_idx", b"callback_idx", "closing_error", b"closing_error", "constant_response", b"constant_response", "is_push", b"is_push", "request_error", b"request_error", "resp_pointer", b"resp_pointer", "value", b"value"]) -> None: ...
99
- def WhichOneof(self, oneof_group: typing.Literal["value", b"value"]) -> typing.Literal["resp_pointer", "constant_response", "request_error", "closing_error"] | None: ...
100
-
101
- global___Response = Response
glide/routes.py DELETED
@@ -1,114 +0,0 @@
1
- # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
-
3
- from enum import Enum
4
- from typing import Optional
5
-
6
- from glide.exceptions import RequestError
7
- from glide.protobuf.command_request_pb2 import CommandRequest, SimpleRoutes
8
- from glide.protobuf.command_request_pb2 import SlotTypes as ProtoSlotTypes
9
-
10
-
11
- class SlotType(Enum):
12
- PRIMARY = 1
13
- # `REPLICA` overrides the `read_from_replica` configuration. If it's used the request
14
- # will be routed to a replica, even if the strategy is `ALWAYS_FROM_MASTER`.
15
- REPLICA = 2
16
-
17
-
18
- class Route:
19
- def __init__(self) -> None:
20
- pass
21
-
22
-
23
- # cluster routes
24
-
25
-
26
- class AllNodes(Route):
27
- """
28
- Route request to all nodes.
29
- Warning:
30
- Don't use it with write commands, they could be routed to a replica (RO) node and fail.
31
- """
32
-
33
- pass
34
-
35
-
36
- class AllPrimaries(Route):
37
- pass
38
-
39
-
40
- class RandomNode(Route):
41
- """
42
- Route request to a random node.
43
- Warning:
44
- Don't use it with write commands, because they could be randomly routed to a replica (RO) node and fail.
45
- """
46
-
47
- pass
48
-
49
-
50
- class SlotKeyRoute(Route):
51
- def __init__(self, slot_type: SlotType, slot_key: str) -> None:
52
- super().__init__()
53
- self.slot_type = slot_type
54
- self.slot_key = slot_key
55
-
56
-
57
- class SlotIdRoute(Route):
58
- def __init__(self, slot_type: SlotType, slot_id: int) -> None:
59
- super().__init__()
60
- self.slot_type = slot_type
61
- self.slot_id = slot_id
62
-
63
-
64
- class ByAddressRoute(Route):
65
- def __init__(self, host: str, port: Optional[int] = None) -> None:
66
- """Routes a request to a node by its address
67
-
68
- Args:
69
- host (str): The endpoint of the node. If `port` is not provided, should be in the f"{address}:{port}" format, where `address` is the preferred endpoint as shown in the output of the `CLUSTER SLOTS` command.
70
- port (Optional[int]): The port to access on the node. If port is not provided, `host` is assumed to be in the format f"{address}:{port}".
71
- """
72
- super().__init__()
73
- if port is None:
74
- split = host.split(":")
75
- if len(split) < 2:
76
- raise RequestError(
77
- "No port provided, expected host to be formatted as {hostname}:{port}`. Received "
78
- + host
79
- )
80
- self.host = split[0]
81
- self.port = int(split[1])
82
- else:
83
- self.host = host
84
- self.port = port
85
-
86
-
87
- def to_protobuf_slot_type(slot_type: SlotType) -> ProtoSlotTypes.ValueType:
88
- return (
89
- ProtoSlotTypes.Primary
90
- if slot_type == SlotType.PRIMARY
91
- else ProtoSlotTypes.Replica
92
- )
93
-
94
-
95
- def set_protobuf_route(request: CommandRequest, route: Optional[Route]) -> None:
96
- if route is None:
97
- return
98
- elif isinstance(route, AllNodes):
99
- request.route.simple_routes = SimpleRoutes.AllNodes
100
- elif isinstance(route, AllPrimaries):
101
- request.route.simple_routes = SimpleRoutes.AllPrimaries
102
- elif isinstance(route, RandomNode):
103
- request.route.simple_routes = SimpleRoutes.Random
104
- elif isinstance(route, SlotKeyRoute):
105
- request.route.slot_key_route.slot_type = to_protobuf_slot_type(route.slot_type)
106
- request.route.slot_key_route.slot_key = route.slot_key
107
- elif isinstance(route, SlotIdRoute):
108
- request.route.slot_id_route.slot_type = to_protobuf_slot_type(route.slot_type)
109
- request.route.slot_id_route.slot_id = route.slot_id
110
- elif isinstance(route, ByAddressRoute):
111
- request.route.by_address_route.host = route.host
112
- request.route.by_address_route.port = route.port
113
- else:
114
- raise RequestError(f"Received invalid route type: {type(route)}")