valkey-glide 1.3.5__pp39-pypy39_pp73-macosx_10_7_x86_64.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 (37) hide show
  1. glide/__init__.py +330 -0
  2. glide/async_commands/__init__.py +5 -0
  3. glide/async_commands/bitmap.py +311 -0
  4. glide/async_commands/cluster_commands.py +1294 -0
  5. glide/async_commands/command_args.py +102 -0
  6. glide/async_commands/core.py +7040 -0
  7. glide/async_commands/server_modules/ft.py +395 -0
  8. glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +293 -0
  9. glide/async_commands/server_modules/ft_options/ft_constants.py +84 -0
  10. glide/async_commands/server_modules/ft_options/ft_create_options.py +409 -0
  11. glide/async_commands/server_modules/ft_options/ft_profile_options.py +108 -0
  12. glide/async_commands/server_modules/ft_options/ft_search_options.py +131 -0
  13. glide/async_commands/server_modules/glide_json.py +1255 -0
  14. glide/async_commands/server_modules/json_batch.py +790 -0
  15. glide/async_commands/sorted_set.py +402 -0
  16. glide/async_commands/standalone_commands.py +935 -0
  17. glide/async_commands/stream.py +442 -0
  18. glide/async_commands/transaction.py +5175 -0
  19. glide/config.py +590 -0
  20. glide/constants.py +120 -0
  21. glide/exceptions.py +62 -0
  22. glide/glide.pyi +36 -0
  23. glide/glide.pypy39-pp73-darwin.so +0 -0
  24. glide/glide_client.py +604 -0
  25. glide/logger.py +85 -0
  26. glide/protobuf/command_request_pb2.py +54 -0
  27. glide/protobuf/command_request_pb2.pyi +1164 -0
  28. glide/protobuf/connection_request_pb2.py +52 -0
  29. glide/protobuf/connection_request_pb2.pyi +292 -0
  30. glide/protobuf/response_pb2.py +32 -0
  31. glide/protobuf/response_pb2.pyi +101 -0
  32. glide/protobuf_codec.py +109 -0
  33. glide/py.typed +0 -0
  34. glide/routes.py +114 -0
  35. valkey_glide-1.3.5.dist-info/METADATA +125 -0
  36. valkey_glide-1.3.5.dist-info/RECORD +37 -0
  37. valkey_glide-1.3.5.dist-info/WHEEL +4 -0
@@ -0,0 +1,52 @@
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)
@@ -0,0 +1,292 @@
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
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: protobuf/response.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\x17protobuf/response.proto\x12\x08response\"I\n\x0cRequestError\x12(\n\x04type\x18\x01 \x01(\x0e\x32\x1a.response.RequestErrorType\x12\x0f\n\x07message\x18\x02 \x01(\t\"\xd5\x01\n\x08Response\x12\x14\n\x0c\x63\x61llback_idx\x18\x01 \x01(\r\x12\x16\n\x0cresp_pointer\x18\x02 \x01(\x04H\x00\x12\x37\n\x11\x63onstant_response\x18\x03 \x01(\x0e\x32\x1a.response.ConstantResponseH\x00\x12/\n\rrequest_error\x18\x04 \x01(\x0b\x32\x16.response.RequestErrorH\x00\x12\x17\n\rclosing_error\x18\x05 \x01(\tH\x00\x12\x0f\n\x07is_push\x18\x06 \x01(\x08\x42\x07\n\x05value*O\n\x10RequestErrorType\x12\x0f\n\x0bUnspecified\x10\x00\x12\r\n\tExecAbort\x10\x01\x12\x0b\n\x07Timeout\x10\x02\x12\x0e\n\nDisconnect\x10\x03*\x1a\n\x10\x43onstantResponse\x12\x06\n\x02OK\x10\x00\x62\x06proto3')
18
+
19
+ _globals = globals()
20
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'protobuf.response_pb2', _globals)
22
+ if _descriptor._USE_C_DESCRIPTORS == False:
23
+ DESCRIPTOR._options = None
24
+ _globals['_REQUESTERRORTYPE']._serialized_start=328
25
+ _globals['_REQUESTERRORTYPE']._serialized_end=407
26
+ _globals['_CONSTANTRESPONSE']._serialized_start=409
27
+ _globals['_CONSTANTRESPONSE']._serialized_end=435
28
+ _globals['_REQUESTERROR']._serialized_start=37
29
+ _globals['_REQUESTERROR']._serialized_end=110
30
+ _globals['_RESPONSE']._serialized_start=113
31
+ _globals['_RESPONSE']._serialized_end=326
32
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,101 @@
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
@@ -0,0 +1,109 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+
3
+ import struct
4
+ from typing import List, Tuple, Type
5
+
6
+ from google.protobuf import message
7
+
8
+ """
9
+ Codec for protobuf messages.
10
+ All of the Varint functions were copied from https://github.com/protocolbuffers/protobuf
11
+ """
12
+
13
+
14
+ class ProtobufCodec:
15
+ @classmethod
16
+ def _decode_varint_32(cls, buffer, pos):
17
+ decoder_func = cls._varint_decoder((1 << 32) - 1, int)
18
+ return decoder_func(buffer, pos)
19
+
20
+ @staticmethod
21
+ def _varint_decoder(mask, result_type):
22
+ """Return an encoder for a basic varint value (does not include tag).
23
+
24
+ Decoded values will be bitwise-anded with the given mask before being
25
+ returned, e.g. to limit them to 32 bits. The returned decoder does not
26
+ take the usual "end" parameter -- the caller is expected to do bounds checking
27
+ after the fact (often the caller can defer such checking until later). The
28
+ decoder returns a (value, new_pos) pair.
29
+ """
30
+
31
+ def decode_varint(buffer, pos):
32
+ result = 0
33
+ shift = 0
34
+ while 1:
35
+ b = buffer[pos]
36
+ result |= (b & 0x7F) << shift
37
+ pos += 1
38
+ if not (b & 0x80):
39
+ result &= mask
40
+ result = result_type(result)
41
+ return (result, pos)
42
+ shift += 7
43
+ if shift >= 64:
44
+ raise message.DecodeError("Too many bytes when decoding varint.")
45
+
46
+ return decode_varint
47
+
48
+ @staticmethod
49
+ def _varint_encoder():
50
+ """Return an encoder for a basic varint value (does not include tag)."""
51
+
52
+ local_int2byte = struct.Struct(">B").pack
53
+
54
+ def encode_varint(write, value):
55
+ bits = value & 0x7F
56
+ value >>= 7
57
+ while value:
58
+ write(local_int2byte(0x80 | bits))
59
+ bits = value & 0x7F
60
+ value >>= 7
61
+ return write(local_int2byte(bits))
62
+
63
+ return encode_varint
64
+
65
+ @classmethod
66
+ def _varint_bytes(cls, value: int) -> bytes:
67
+ """Encode the given integer as a varint and return the bytes."""
68
+
69
+ pieces: List[bytes] = []
70
+ func = cls._varint_encoder()
71
+ func(pieces.append, value)
72
+ return b"".join(pieces)
73
+
74
+ @classmethod
75
+ def decode_delimited(
76
+ cls,
77
+ read_bytes: bytearray,
78
+ read_bytes_view: memoryview,
79
+ offset: int,
80
+ message_class: Type[message.Message],
81
+ ) -> Tuple[message.Message, int]:
82
+ try:
83
+ msg_len, new_pos = cls._decode_varint_32(read_bytes_view, offset)
84
+ except IndexError:
85
+ # Didn't read enough bytes to decode the varint
86
+ raise PartialMessageException(
87
+ "Didn't read enough bytes to decode the varint"
88
+ )
89
+ required_read_size = new_pos + msg_len
90
+ if required_read_size > len(read_bytes):
91
+ # Recieved only partial response
92
+ raise PartialMessageException("Recieved only a partial response")
93
+ offset = new_pos
94
+ msg_buf = read_bytes_view[offset : offset + msg_len]
95
+ offset += msg_len
96
+ message = message_class()
97
+ message.ParseFromString(msg_buf)
98
+ return (message, offset)
99
+
100
+ @classmethod
101
+ def encode_delimited(cls, b_arr: bytearray, message: message.Message) -> None:
102
+ bytes_request = message.SerializeToString()
103
+ varint = cls._varint_bytes(len(bytes_request))
104
+ b_arr.extend(varint)
105
+ b_arr.extend(bytes_request)
106
+
107
+
108
+ class PartialMessageException(Exception):
109
+ pass
glide/py.typed ADDED
File without changes