valkey-glide 1.2.0rc14__cp311-cp311-macosx_11_0_arm64.whl → 2.2.3__cp311-cp311-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.
- glide/__init__.py +169 -104
- glide/async_commands/cluster_commands.py +367 -172
- glide/async_commands/core.py +1808 -1026
- glide/async_commands/{server_modules/ft.py → ft.py} +91 -21
- glide/async_commands/{server_modules/glide_json.py → glide_json.py} +161 -146
- glide/async_commands/standalone_commands.py +204 -136
- glide/glide.cpython-311-darwin.so +0 -0
- glide/glide.pyi +26 -1
- glide/glide_client.py +355 -136
- glide/logger.py +34 -22
- glide/opentelemetry.py +185 -0
- glide_shared/__init__.py +330 -0
- glide_shared/commands/__init__.py +0 -0
- glide/async_commands/transaction.py → glide_shared/commands/batch.py +1845 -1059
- glide_shared/commands/batch_options.py +261 -0
- {glide/async_commands → glide_shared/commands}/bitmap.py +96 -86
- {glide/async_commands → glide_shared/commands}/command_args.py +7 -6
- glide_shared/commands/core_options.py +407 -0
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_aggregate_options.py +18 -11
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_create_options.py +27 -13
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_profile_options.py +16 -11
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_search_options.py +17 -9
- glide_shared/commands/server_modules/json_batch.py +820 -0
- glide_shared/commands/server_modules/json_options.py +93 -0
- {glide/async_commands → glide_shared/commands}/sorted_set.py +42 -32
- {glide/async_commands → glide_shared/commands}/stream.py +95 -88
- glide_shared/config.py +975 -0
- {glide → glide_shared}/constants.py +11 -7
- {glide → glide_shared}/exceptions.py +27 -1
- glide_shared/protobuf/command_request_pb2.py +56 -0
- glide_shared/protobuf/connection_request_pb2.py +56 -0
- {glide → glide_shared}/protobuf/response_pb2.py +6 -6
- {glide → glide_shared}/protobuf_codec.py +7 -6
- glide_shared/routes.py +161 -0
- valkey_glide-2.2.3.dist-info/METADATA +211 -0
- valkey_glide-2.2.3.dist-info/RECORD +40 -0
- {valkey_glide-1.2.0rc14.dist-info → valkey_glide-2.2.3.dist-info}/WHEEL +1 -1
- glide/config.py +0 -521
- glide/protobuf/command_request_pb2.py +0 -54
- glide/protobuf/command_request_pb2.pyi +0 -1161
- glide/protobuf/connection_request_pb2.py +0 -52
- glide/protobuf/connection_request_pb2.pyi +0 -287
- glide/protobuf/response_pb2.pyi +0 -101
- glide/routes.py +0 -114
- valkey_glide-1.2.0rc14.dist-info/METADATA +0 -122
- valkey_glide-1.2.0rc14.dist-info/RECORD +0 -36
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_constants.py +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Dict, List, Literal, Mapping, Optional, Set, TypeVar, Union
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
5
|
+
from glide_shared.protobuf.command_request_pb2 import CommandRequest
|
|
6
|
+
from glide_shared.protobuf.connection_request_pb2 import ConnectionRequest
|
|
7
|
+
from glide_shared.routes import ByAddressRoute, RandomNode, SlotIdRoute, SlotKeyRoute
|
|
8
8
|
|
|
9
9
|
OK: str = "OK"
|
|
10
10
|
DEFAULT_READ_BYTES_SIZE: int = pow(2, 16)
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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[
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
2
2
|
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Optional, Type
|
|
4
|
+
|
|
5
|
+
from glide_shared.protobuf.response_pb2 import RequestErrorType
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
class GlideError(Exception):
|
|
@@ -60,3 +62,27 @@ class ConfigurationError(RequestError):
|
|
|
60
62
|
"""
|
|
61
63
|
Errors that are thrown when a request cannot be completed in current configuration settings.
|
|
62
64
|
"""
|
|
65
|
+
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class LoggerError(GlideError):
|
|
70
|
+
"""
|
|
71
|
+
Errors that are thrown when the logger has an error initializing.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_request_error_class(
|
|
78
|
+
error_type: Optional[RequestErrorType.ValueType],
|
|
79
|
+
) -> Type[RequestError]:
|
|
80
|
+
if error_type == RequestErrorType.Disconnect:
|
|
81
|
+
return ConnectionError
|
|
82
|
+
if error_type == RequestErrorType.ExecAbort:
|
|
83
|
+
return ExecAbortError
|
|
84
|
+
if error_type == RequestErrorType.Timeout:
|
|
85
|
+
return TimeoutError
|
|
86
|
+
if error_type == RequestErrorType.Unspecified:
|
|
87
|
+
return RequestError
|
|
88
|
+
return RequestError
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: protobuf/command_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\x1eprotobuf/command_request.proto\x12\x0f\x63ommand_request\"M\n\x0bSlotIdRoute\x12-\n\tslot_type\x18\x01 \x01(\x0e\x32\x1a.command_request.SlotTypes\x12\x0f\n\x07slot_id\x18\x02 \x01(\x05\"O\n\x0cSlotKeyRoute\x12-\n\tslot_type\x18\x01 \x01(\x0e\x32\x1a.command_request.SlotTypes\x12\x10\n\x08slot_key\x18\x02 \x01(\t\",\n\x0e\x42yAddressRoute\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\x05\"\xf6\x01\n\x06Routes\x12\x36\n\rsimple_routes\x18\x01 \x01(\x0e\x32\x1d.command_request.SimpleRoutesH\x00\x12\x37\n\x0eslot_key_route\x18\x02 \x01(\x0b\x32\x1d.command_request.SlotKeyRouteH\x00\x12\x35\n\rslot_id_route\x18\x03 \x01(\x0b\x32\x1c.command_request.SlotIdRouteH\x00\x12;\n\x10\x62y_address_route\x18\x04 \x01(\x0b\x32\x1f.command_request.ByAddressRouteH\x00\x42\x07\n\x05value\"\xb6\x01\n\x07\x43ommand\x12\x32\n\x0crequest_type\x18\x01 \x01(\x0e\x32\x1c.command_request.RequestType\x12\x38\n\nargs_array\x18\x02 \x01(\x0b\x32\".command_request.Command.ArgsArrayH\x00\x12\x1a\n\x10\x61rgs_vec_pointer\x18\x03 \x01(\x04H\x00\x1a\x19\n\tArgsArray\x12\x0c\n\x04\x61rgs\x18\x01 \x03(\x0c\x42\x06\n\x04\x61rgs\"\x80\x01\n\x18ScriptInvocationPointers\x12\x0c\n\x04hash\x18\x01 \x01(\t\x12\x19\n\x0ckeys_pointer\x18\x02 \x01(\x04H\x00\x88\x01\x01\x12\x19\n\x0c\x61rgs_pointer\x18\x03 \x01(\x04H\x01\x88\x01\x01\x42\x0f\n\r_keys_pointerB\x0f\n\r_args_pointer\"<\n\x10ScriptInvocation\x12\x0c\n\x04hash\x18\x01 \x01(\t\x12\x0c\n\x04keys\x18\x02 \x03(\x0c\x12\x0c\n\x04\x61rgs\x18\x03 \x03(\x0c\"\x90\x02\n\x05\x42\x61tch\x12\x11\n\tis_atomic\x18\x01 \x01(\x08\x12*\n\x08\x63ommands\x18\x02 \x03(\x0b\x32\x18.command_request.Command\x12\x1b\n\x0eraise_on_error\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12\x14\n\x07timeout\x18\x04 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12retry_server_error\x18\x05 \x01(\x08H\x02\x88\x01\x01\x12#\n\x16retry_connection_error\x18\x06 \x01(\x08H\x03\x88\x01\x01\x42\x11\n\x0f_raise_on_errorB\n\n\x08_timeoutB\x15\n\x13_retry_server_errorB\x19\n\x17_retry_connection_error\"\xb4\x01\n\x0b\x43lusterScan\x12\x0e\n\x06\x63ursor\x18\x01 \x01(\t\x12\x1a\n\rmatch_pattern\x18\x02 \x01(\x0cH\x00\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x03H\x01\x88\x01\x01\x12\x18\n\x0bobject_type\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x1f\n\x17\x61llow_non_covered_slots\x18\x05 \x01(\x08\x42\x10\n\x0e_match_patternB\x08\n\x06_countB\x0e\n\x0c_object_type\"V\n\x18UpdateConnectionPassword\x12\x15\n\x08password\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\x0eimmediate_auth\x18\x02 \x01(\x08\x42\x0b\n\t_password\"\x11\n\x0fRefreshIamToken\"\xbb\x04\n\x0e\x43ommandRequest\x12\x14\n\x0c\x63\x61llback_idx\x18\x01 \x01(\r\x12\x32\n\x0esingle_command\x18\x02 \x01(\x0b\x32\x18.command_request.CommandH\x00\x12\'\n\x05\x62\x61tch\x18\x03 \x01(\x0b\x32\x16.command_request.BatchH\x00\x12>\n\x11script_invocation\x18\x04 \x01(\x0b\x32!.command_request.ScriptInvocationH\x00\x12O\n\x1ascript_invocation_pointers\x18\x05 \x01(\x0b\x32).command_request.ScriptInvocationPointersH\x00\x12\x34\n\x0c\x63luster_scan\x18\x06 \x01(\x0b\x32\x1c.command_request.ClusterScanH\x00\x12O\n\x1aupdate_connection_password\x18\x07 \x01(\x0b\x32).command_request.UpdateConnectionPasswordH\x00\x12=\n\x11refresh_iam_token\x18\x08 \x01(\x0b\x32 .command_request.RefreshIamTokenH\x00\x12&\n\x05route\x18\t \x01(\x0b\x32\x17.command_request.Routes\x12\x1a\n\rroot_span_ptr\x18\n \x01(\x04H\x01\x88\x01\x01\x42\t\n\x07\x63ommandB\x10\n\x0e_root_span_ptr*:\n\x0cSimpleRoutes\x12\x0c\n\x08\x41llNodes\x10\x00\x12\x10\n\x0c\x41llPrimaries\x10\x01\x12\n\n\x06Random\x10\x02*%\n\tSlotTypes\x12\x0b\n\x07Primary\x10\x00\x12\x0b\n\x07Replica\x10\x01*\xea\x30\n\x0bRequestType\x12\x12\n\x0eInvalidRequest\x10\x00\x12\x11\n\rCustomCommand\x10\x01\x12\x0c\n\x08\x42itCount\x10\x65\x12\x0c\n\x08\x42itField\x10\x66\x12\x14\n\x10\x42itFieldReadOnly\x10g\x12\t\n\x05\x42itOp\x10h\x12\n\n\x06\x42itPos\x10i\x12\n\n\x06GetBit\x10j\x12\n\n\x06SetBit\x10k\x12\x0b\n\x06\x41sking\x10\xc9\x01\x12\x14\n\x0f\x43lusterAddSlots\x10\xca\x01\x12\x19\n\x14\x43lusterAddSlotsRange\x10\xcb\x01\x12\x15\n\x10\x43lusterBumpEpoch\x10\xcc\x01\x12\x1f\n\x1a\x43lusterCountFailureReports\x10\xcd\x01\x12\x1b\n\x16\x43lusterCountKeysInSlot\x10\xce\x01\x12\x14\n\x0f\x43lusterDelSlots\x10\xcf\x01\x12\x19\n\x14\x43lusterDelSlotsRange\x10\xd0\x01\x12\x14\n\x0f\x43lusterFailover\x10\xd1\x01\x12\x16\n\x11\x43lusterFlushSlots\x10\xd2\x01\x12\x12\n\rClusterForget\x10\xd3\x01\x12\x19\n\x14\x43lusterGetKeysInSlot\x10\xd4\x01\x12\x10\n\x0b\x43lusterInfo\x10\xd5\x01\x12\x13\n\x0e\x43lusterKeySlot\x10\xd6\x01\x12\x11\n\x0c\x43lusterLinks\x10\xd7\x01\x12\x10\n\x0b\x43lusterMeet\x10\xd8\x01\x12\x10\n\x0b\x43lusterMyId\x10\xd9\x01\x12\x15\n\x10\x43lusterMyShardId\x10\xda\x01\x12\x11\n\x0c\x43lusterNodes\x10\xdb\x01\x12\x14\n\x0f\x43lusterReplicas\x10\xdc\x01\x12\x15\n\x10\x43lusterReplicate\x10\xdd\x01\x12\x11\n\x0c\x43lusterReset\x10\xde\x01\x12\x16\n\x11\x43lusterSaveConfig\x10\xdf\x01\x12\x1a\n\x15\x43lusterSetConfigEpoch\x10\xe0\x01\x12\x13\n\x0e\x43lusterSetslot\x10\xe1\x01\x12\x12\n\rClusterShards\x10\xe2\x01\x12\x12\n\rClusterSlaves\x10\xe3\x01\x12\x11\n\x0c\x43lusterSlots\x10\xe4\x01\x12\r\n\x08ReadOnly\x10\xe5\x01\x12\x0e\n\tReadWrite\x10\xe6\x01\x12\t\n\x04\x41uth\x10\xad\x02\x12\x12\n\rClientCaching\x10\xae\x02\x12\x12\n\rClientGetName\x10\xaf\x02\x12\x13\n\x0e\x43lientGetRedir\x10\xb0\x02\x12\r\n\x08\x43lientId\x10\xb1\x02\x12\x0f\n\nClientInfo\x10\xb2\x02\x12\x15\n\x10\x43lientKillSimple\x10\xb3\x02\x12\x0f\n\nClientKill\x10\xb4\x02\x12\x0f\n\nClientList\x10\xb5\x02\x12\x12\n\rClientNoEvict\x10\xb6\x02\x12\x12\n\rClientNoTouch\x10\xb7\x02\x12\x10\n\x0b\x43lientPause\x10\xb8\x02\x12\x10\n\x0b\x43lientReply\x10\xb9\x02\x12\x12\n\rClientSetInfo\x10\xba\x02\x12\x12\n\rClientSetName\x10\xbb\x02\x12\x13\n\x0e\x43lientTracking\x10\xbc\x02\x12\x17\n\x12\x43lientTrackingInfo\x10\xbd\x02\x12\x12\n\rClientUnblock\x10\xbe\x02\x12\x12\n\rClientUnpause\x10\xbf\x02\x12\t\n\x04\x45\x63ho\x10\xc0\x02\x12\n\n\x05Hello\x10\xc1\x02\x12\t\n\x04Ping\x10\xc2\x02\x12\t\n\x04Quit\x10\xc3\x02\x12\n\n\x05Reset\x10\xc4\x02\x12\x0b\n\x06Select\x10\xc5\x02\x12\t\n\x04\x43opy\x10\x91\x03\x12\x08\n\x03\x44\x65l\x10\x92\x03\x12\t\n\x04\x44ump\x10\x93\x03\x12\x0b\n\x06\x45xists\x10\x94\x03\x12\x0b\n\x06\x45xpire\x10\x95\x03\x12\r\n\x08\x45xpireAt\x10\x96\x03\x12\x0f\n\nExpireTime\x10\x97\x03\x12\t\n\x04Keys\x10\x98\x03\x12\x0c\n\x07Migrate\x10\x99\x03\x12\t\n\x04Move\x10\x9a\x03\x12\x13\n\x0eObjectEncoding\x10\x9b\x03\x12\x0f\n\nObjectFreq\x10\x9c\x03\x12\x13\n\x0eObjectIdleTime\x10\x9d\x03\x12\x13\n\x0eObjectRefCount\x10\x9e\x03\x12\x0c\n\x07Persist\x10\x9f\x03\x12\x0c\n\x07PExpire\x10\xa0\x03\x12\x0e\n\tPExpireAt\x10\xa1\x03\x12\x10\n\x0bPExpireTime\x10\xa2\x03\x12\t\n\x04PTTL\x10\xa3\x03\x12\x0e\n\tRandomKey\x10\xa4\x03\x12\x0b\n\x06Rename\x10\xa5\x03\x12\r\n\x08RenameNX\x10\xa6\x03\x12\x0c\n\x07Restore\x10\xa7\x03\x12\t\n\x04Scan\x10\xa8\x03\x12\t\n\x04Sort\x10\xa9\x03\x12\x11\n\x0cSortReadOnly\x10\xaa\x03\x12\n\n\x05Touch\x10\xab\x03\x12\x08\n\x03TTL\x10\xac\x03\x12\t\n\x04Type\x10\xad\x03\x12\x0b\n\x06Unlink\x10\xae\x03\x12\t\n\x04Wait\x10\xaf\x03\x12\x0c\n\x07WaitAof\x10\xb0\x03\x12\x0b\n\x06GeoAdd\x10\xf5\x03\x12\x0c\n\x07GeoDist\x10\xf6\x03\x12\x0c\n\x07GeoHash\x10\xf7\x03\x12\x0b\n\x06GeoPos\x10\xf8\x03\x12\x0e\n\tGeoRadius\x10\xf9\x03\x12\x16\n\x11GeoRadiusReadOnly\x10\xfa\x03\x12\x16\n\x11GeoRadiusByMember\x10\xfb\x03\x12\x1e\n\x19GeoRadiusByMemberReadOnly\x10\xfc\x03\x12\x0e\n\tGeoSearch\x10\xfd\x03\x12\x13\n\x0eGeoSearchStore\x10\xfe\x03\x12\t\n\x04HDel\x10\xd9\x04\x12\x0c\n\x07HExists\x10\xda\x04\x12\t\n\x04HGet\x10\xdb\x04\x12\x0c\n\x07HGetAll\x10\xdc\x04\x12\x0c\n\x07HIncrBy\x10\xdd\x04\x12\x11\n\x0cHIncrByFloat\x10\xde\x04\x12\n\n\x05HKeys\x10\xdf\x04\x12\t\n\x04HLen\x10\xe0\x04\x12\n\n\x05HMGet\x10\xe1\x04\x12\n\n\x05HMSet\x10\xe2\x04\x12\x0f\n\nHRandField\x10\xe3\x04\x12\n\n\x05HScan\x10\xe4\x04\x12\t\n\x04HSet\x10\xe5\x04\x12\x0b\n\x06HSetNX\x10\xe6\x04\x12\x0c\n\x07HStrlen\x10\xe7\x04\x12\n\n\x05HVals\x10\xe8\x04\x12\x0b\n\x06HSetEx\x10\xe9\x04\x12\x0b\n\x06HGetEx\x10\xea\x04\x12\x0c\n\x07HExpire\x10\xeb\x04\x12\x0e\n\tHExpireAt\x10\xec\x04\x12\r\n\x08HPExpire\x10\xed\x04\x12\x0f\n\nHPExpireAt\x10\xee\x04\x12\r\n\x08HPersist\x10\xef\x04\x12\t\n\x04HTtl\x10\xf0\x04\x12\n\n\x05HPTtl\x10\xf1\x04\x12\x10\n\x0bHExpireTime\x10\xf2\x04\x12\x11\n\x0cHPExpireTime\x10\xf3\x04\x12\n\n\x05PfAdd\x10\xbd\x05\x12\x0c\n\x07PfCount\x10\xbe\x05\x12\x0c\n\x07PfMerge\x10\xbf\x05\x12\x0b\n\x06\x42LMove\x10\xa1\x06\x12\x0b\n\x06\x42LMPop\x10\xa2\x06\x12\n\n\x05\x42LPop\x10\xa3\x06\x12\n\n\x05\x42RPop\x10\xa4\x06\x12\x0f\n\nBRPopLPush\x10\xa5\x06\x12\x0b\n\x06LIndex\x10\xa6\x06\x12\x0c\n\x07LInsert\x10\xa7\x06\x12\t\n\x04LLen\x10\xa8\x06\x12\n\n\x05LMove\x10\xa9\x06\x12\n\n\x05LMPop\x10\xaa\x06\x12\t\n\x04LPop\x10\xab\x06\x12\t\n\x04LPos\x10\xac\x06\x12\n\n\x05LPush\x10\xad\x06\x12\x0b\n\x06LPushX\x10\xae\x06\x12\x0b\n\x06LRange\x10\xaf\x06\x12\t\n\x04LRem\x10\xb0\x06\x12\t\n\x04LSet\x10\xb1\x06\x12\n\n\x05LTrim\x10\xb2\x06\x12\t\n\x04RPop\x10\xb3\x06\x12\x0e\n\tRPopLPush\x10\xb4\x06\x12\n\n\x05RPush\x10\xb5\x06\x12\x0b\n\x06RPushX\x10\xb6\x06\x12\x0f\n\nPSubscribe\x10\x85\x07\x12\x0c\n\x07Publish\x10\x86\x07\x12\x13\n\x0ePubSubChannels\x10\x87\x07\x12\x11\n\x0cPubSubNumPat\x10\x88\x07\x12\x11\n\x0cPubSubNumSub\x10\x89\x07\x12\x18\n\x13PubSubShardChannels\x10\x8a\x07\x12\x16\n\x11PubSubShardNumSub\x10\x8b\x07\x12\x11\n\x0cPUnsubscribe\x10\x8c\x07\x12\r\n\x08SPublish\x10\x8d\x07\x12\x0f\n\nSSubscribe\x10\x8e\x07\x12\x0e\n\tSubscribe\x10\x8f\x07\x12\x11\n\x0cSUnsubscribe\x10\x90\x07\x12\x10\n\x0bUnsubscribe\x10\x91\x07\x12\t\n\x04\x45val\x10\xe9\x07\x12\x11\n\x0c\x45valReadOnly\x10\xea\x07\x12\x0c\n\x07\x45valSha\x10\xeb\x07\x12\x14\n\x0f\x45valShaReadOnly\x10\xec\x07\x12\n\n\x05\x46\x43\x61ll\x10\xed\x07\x12\x12\n\rFCallReadOnly\x10\xee\x07\x12\x13\n\x0e\x46unctionDelete\x10\xef\x07\x12\x11\n\x0c\x46unctionDump\x10\xf0\x07\x12\x12\n\rFunctionFlush\x10\xf1\x07\x12\x11\n\x0c\x46unctionKill\x10\xf2\x07\x12\x11\n\x0c\x46unctionList\x10\xf3\x07\x12\x11\n\x0c\x46unctionLoad\x10\xf4\x07\x12\x14\n\x0f\x46unctionRestore\x10\xf5\x07\x12\x12\n\rFunctionStats\x10\xf6\x07\x12\x10\n\x0bScriptDebug\x10\xf7\x07\x12\x11\n\x0cScriptExists\x10\xf8\x07\x12\x10\n\x0bScriptFlush\x10\xf9\x07\x12\x0f\n\nScriptKill\x10\xfa\x07\x12\x0f\n\nScriptLoad\x10\xfb\x07\x12\x0f\n\nScriptShow\x10\xfc\x07\x12\x0b\n\x06\x41\x63lCat\x10\xcd\x08\x12\x0f\n\nAclDelUser\x10\xce\x08\x12\x0e\n\tAclDryRun\x10\xcf\x08\x12\x0f\n\nAclGenPass\x10\xd0\x08\x12\x0f\n\nAclGetUser\x10\xd1\x08\x12\x0c\n\x07\x41\x63lList\x10\xd2\x08\x12\x0c\n\x07\x41\x63lLoad\x10\xd3\x08\x12\x0b\n\x06\x41\x63lLog\x10\xd4\x08\x12\x0c\n\x07\x41\x63lSave\x10\xd5\x08\x12\x0f\n\nAclSetSser\x10\xd6\x08\x12\r\n\x08\x41\x63lUsers\x10\xd7\x08\x12\x0e\n\tAclWhoami\x10\xd8\x08\x12\x11\n\x0c\x42gRewriteAof\x10\xd9\x08\x12\x0b\n\x06\x42gSave\x10\xda\x08\x12\r\n\x08\x43ommand_\x10\xdb\x08\x12\x11\n\x0c\x43ommandCount\x10\xdc\x08\x12\x10\n\x0b\x43ommandDocs\x10\xdd\x08\x12\x13\n\x0e\x43ommandGetKeys\x10\xde\x08\x12\x1b\n\x16\x43ommandGetKeysAndFlags\x10\xdf\x08\x12\x10\n\x0b\x43ommandInfo\x10\xe0\x08\x12\x10\n\x0b\x43ommandList\x10\xe1\x08\x12\x0e\n\tConfigGet\x10\xe2\x08\x12\x14\n\x0f\x43onfigResetStat\x10\xe3\x08\x12\x12\n\rConfigRewrite\x10\xe4\x08\x12\x0e\n\tConfigSet\x10\xe5\x08\x12\x0b\n\x06\x44\x42Size\x10\xe6\x08\x12\r\n\x08\x46\x61ilOver\x10\xe7\x08\x12\r\n\x08\x46lushAll\x10\xe8\x08\x12\x0c\n\x07\x46lushDB\x10\xe9\x08\x12\t\n\x04Info\x10\xea\x08\x12\r\n\x08LastSave\x10\xeb\x08\x12\x12\n\rLatencyDoctor\x10\xec\x08\x12\x11\n\x0cLatencyGraph\x10\xed\x08\x12\x15\n\x10LatencyHistogram\x10\xee\x08\x12\x13\n\x0eLatencyHistory\x10\xef\x08\x12\x12\n\rLatencyLatest\x10\xf0\x08\x12\x11\n\x0cLatencyReset\x10\xf1\x08\x12\x0b\n\x06Lolwut\x10\xf2\x08\x12\x11\n\x0cMemoryDoctor\x10\xf3\x08\x12\x16\n\x11MemoryMallocStats\x10\xf4\x08\x12\x10\n\x0bMemoryPurge\x10\xf5\x08\x12\x10\n\x0bMemoryStats\x10\xf6\x08\x12\x10\n\x0bMemoryUsage\x10\xf7\x08\x12\x0f\n\nModuleList\x10\xf8\x08\x12\x0f\n\nModuleLoad\x10\xf9\x08\x12\x11\n\x0cModuleLoadEx\x10\xfa\x08\x12\x11\n\x0cModuleUnload\x10\xfb\x08\x12\x0c\n\x07Monitor\x10\xfc\x08\x12\n\n\x05PSync\x10\xfd\x08\x12\r\n\x08ReplConf\x10\xfe\x08\x12\x0e\n\tReplicaOf\x10\xff\x08\x12\x12\n\rRestoreAsking\x10\x80\t\x12\t\n\x04Role\x10\x81\t\x12\t\n\x04Save\x10\x82\t\x12\r\n\x08ShutDown\x10\x83\t\x12\x0c\n\x07SlaveOf\x10\x84\t\x12\x0f\n\nSlowLogGet\x10\x85\t\x12\x0f\n\nSlowLogLen\x10\x86\t\x12\x11\n\x0cSlowLogReset\x10\x87\t\x12\x0b\n\x06SwapDb\x10\x88\t\x12\t\n\x04Sync\x10\x89\t\x12\t\n\x04Time\x10\x8a\t\x12\t\n\x04SAdd\x10\xb1\t\x12\n\n\x05SCard\x10\xb2\t\x12\n\n\x05SDiff\x10\xb3\t\x12\x0f\n\nSDiffStore\x10\xb4\t\x12\x0b\n\x06SInter\x10\xb5\t\x12\x0f\n\nSInterCard\x10\xb6\t\x12\x10\n\x0bSInterStore\x10\xb7\t\x12\x0e\n\tSIsMember\x10\xb8\t\x12\r\n\x08SMembers\x10\xb9\t\x12\x0f\n\nSMIsMember\x10\xba\t\x12\n\n\x05SMove\x10\xbb\t\x12\t\n\x04SPop\x10\xbc\t\x12\x10\n\x0bSRandMember\x10\xbd\t\x12\t\n\x04SRem\x10\xbe\t\x12\n\n\x05SScan\x10\xbf\t\x12\x0b\n\x06SUnion\x10\xc0\t\x12\x10\n\x0bSUnionStore\x10\xc1\t\x12\x0b\n\x06\x42ZMPop\x10\x95\n\x12\r\n\x08\x42ZPopMax\x10\x96\n\x12\r\n\x08\x42ZPopMin\x10\x97\n\x12\t\n\x04ZAdd\x10\x98\n\x12\n\n\x05ZCard\x10\x99\n\x12\x0b\n\x06ZCount\x10\x9a\n\x12\n\n\x05ZDiff\x10\x9b\n\x12\x0f\n\nZDiffStore\x10\x9c\n\x12\x0c\n\x07ZIncrBy\x10\x9d\n\x12\x0b\n\x06ZInter\x10\x9e\n\x12\x0f\n\nZInterCard\x10\x9f\n\x12\x10\n\x0bZInterStore\x10\xa0\n\x12\x0e\n\tZLexCount\x10\xa1\n\x12\n\n\x05ZMPop\x10\xa2\n\x12\x0c\n\x07ZMScore\x10\xa3\n\x12\x0c\n\x07ZPopMax\x10\xa4\n\x12\x0c\n\x07ZPopMin\x10\xa5\n\x12\x10\n\x0bZRandMember\x10\xa6\n\x12\x0b\n\x06ZRange\x10\xa7\n\x12\x10\n\x0bZRangeByLex\x10\xa8\n\x12\x12\n\rZRangeByScore\x10\xa9\n\x12\x10\n\x0bZRangeStore\x10\xaa\n\x12\n\n\x05ZRank\x10\xab\n\x12\t\n\x04ZRem\x10\xac\n\x12\x13\n\x0eZRemRangeByLex\x10\xad\n\x12\x14\n\x0fZRemRangeByRank\x10\xae\n\x12\x15\n\x10ZRemRangeByScore\x10\xaf\n\x12\x0e\n\tZRevRange\x10\xb0\n\x12\x13\n\x0eZRevRangeByLex\x10\xb1\n\x12\x15\n\x10ZRevRangeByScore\x10\xb2\n\x12\r\n\x08ZRevRank\x10\xb3\n\x12\n\n\x05ZScan\x10\xb4\n\x12\x0b\n\x06ZScore\x10\xb5\n\x12\x0b\n\x06ZUnion\x10\xb6\n\x12\x10\n\x0bZUnionStore\x10\xb7\n\x12\t\n\x04XAck\x10\xf9\n\x12\t\n\x04XAdd\x10\xfa\n\x12\x0f\n\nXAutoClaim\x10\xfb\n\x12\x0b\n\x06XClaim\x10\xfc\n\x12\t\n\x04XDel\x10\xfd\n\x12\x11\n\x0cXGroupCreate\x10\xfe\n\x12\x19\n\x14XGroupCreateConsumer\x10\xff\n\x12\x16\n\x11XGroupDelConsumer\x10\x80\x0b\x12\x12\n\rXGroupDestroy\x10\x81\x0b\x12\x10\n\x0bXGroupSetId\x10\x82\x0b\x12\x13\n\x0eXInfoConsumers\x10\x83\x0b\x12\x10\n\x0bXInfoGroups\x10\x84\x0b\x12\x10\n\x0bXInfoStream\x10\x85\x0b\x12\t\n\x04XLen\x10\x86\x0b\x12\r\n\x08XPending\x10\x87\x0b\x12\x0b\n\x06XRange\x10\x88\x0b\x12\n\n\x05XRead\x10\x89\x0b\x12\x0f\n\nXReadGroup\x10\x8a\x0b\x12\x0e\n\tXRevRange\x10\x8b\x0b\x12\x0b\n\x06XSetId\x10\x8c\x0b\x12\n\n\x05XTrim\x10\x8d\x0b\x12\x0b\n\x06\x41ppend\x10\xdd\x0b\x12\t\n\x04\x44\x65\x63r\x10\xde\x0b\x12\x0b\n\x06\x44\x65\x63rBy\x10\xdf\x0b\x12\x08\n\x03Get\x10\xe0\x0b\x12\x0b\n\x06GetDel\x10\xe1\x0b\x12\n\n\x05GetEx\x10\xe2\x0b\x12\r\n\x08GetRange\x10\xe3\x0b\x12\x0b\n\x06GetSet\x10\xe4\x0b\x12\t\n\x04Incr\x10\xe5\x0b\x12\x0b\n\x06IncrBy\x10\xe6\x0b\x12\x10\n\x0bIncrByFloat\x10\xe7\x0b\x12\x08\n\x03LCS\x10\xe8\x0b\x12\t\n\x04MGet\x10\xe9\x0b\x12\t\n\x04MSet\x10\xea\x0b\x12\x0b\n\x06MSetNX\x10\xeb\x0b\x12\x0b\n\x06PSetEx\x10\xec\x0b\x12\x08\n\x03Set\x10\xed\x0b\x12\n\n\x05SetEx\x10\xee\x0b\x12\n\n\x05SetNX\x10\xef\x0b\x12\r\n\x08SetRange\x10\xf0\x0b\x12\x0b\n\x06Strlen\x10\xf1\x0b\x12\x0b\n\x06Substr\x10\xf2\x0b\x12\x0c\n\x07\x44iscard\x10\xc1\x0c\x12\t\n\x04\x45xec\x10\xc2\x0c\x12\n\n\x05Multi\x10\xc3\x0c\x12\x0c\n\x07UnWatch\x10\xc4\x0c\x12\n\n\x05Watch\x10\xc5\x0c\x12\x12\n\rJsonArrAppend\x10\xd1\x0f\x12\x11\n\x0cJsonArrIndex\x10\xd2\x0f\x12\x12\n\rJsonArrInsert\x10\xd3\x0f\x12\x0f\n\nJsonArrLen\x10\xd4\x0f\x12\x0f\n\nJsonArrPop\x10\xd5\x0f\x12\x10\n\x0bJsonArrTrim\x10\xd6\x0f\x12\x0e\n\tJsonClear\x10\xd7\x0f\x12\x0e\n\tJsonDebug\x10\xd8\x0f\x12\x0c\n\x07JsonDel\x10\xd9\x0f\x12\x0f\n\nJsonForget\x10\xda\x0f\x12\x0c\n\x07JsonGet\x10\xdb\x0f\x12\r\n\x08JsonMGet\x10\xdc\x0f\x12\x12\n\rJsonNumIncrBy\x10\xdd\x0f\x12\x12\n\rJsonNumMultBy\x10\xde\x0f\x12\x10\n\x0bJsonObjKeys\x10\xdf\x0f\x12\x0f\n\nJsonObjLen\x10\xe0\x0f\x12\r\n\x08JsonResp\x10\xe1\x0f\x12\x0c\n\x07JsonSet\x10\xe2\x0f\x12\x12\n\rJsonStrAppend\x10\xe3\x0f\x12\x0f\n\nJsonStrLen\x10\xe4\x0f\x12\x0f\n\nJsonToggle\x10\xe5\x0f\x12\r\n\x08JsonType\x10\xe6\x0f\x12\x0b\n\x06\x46tList\x10\xb5\x10\x12\x10\n\x0b\x46tAggregate\x10\xb6\x10\x12\x0f\n\nFtAliasAdd\x10\xb7\x10\x12\x0f\n\nFtAliasDel\x10\xb8\x10\x12\x10\n\x0b\x46tAliasList\x10\xb9\x10\x12\x12\n\rFtAliasUpdate\x10\xba\x10\x12\r\n\x08\x46tCreate\x10\xbb\x10\x12\x10\n\x0b\x46tDropIndex\x10\xbc\x10\x12\x0e\n\tFtExplain\x10\xbd\x10\x12\x11\n\x0c\x46tExplainCli\x10\xbe\x10\x12\x0b\n\x06\x46tInfo\x10\xbf\x10\x12\x0e\n\tFtProfile\x10\xc0\x10\x12\r\n\x08\x46tSearch\x10\xc1\x10\x62\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'protobuf.command_request_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
_globals['_SIMPLEROUTES']._serialized_start=2023
|
|
25
|
+
_globals['_SIMPLEROUTES']._serialized_end=2081
|
|
26
|
+
_globals['_SLOTTYPES']._serialized_start=2083
|
|
27
|
+
_globals['_SLOTTYPES']._serialized_end=2120
|
|
28
|
+
_globals['_REQUESTTYPE']._serialized_start=2123
|
|
29
|
+
_globals['_REQUESTTYPE']._serialized_end=8373
|
|
30
|
+
_globals['_SLOTIDROUTE']._serialized_start=51
|
|
31
|
+
_globals['_SLOTIDROUTE']._serialized_end=128
|
|
32
|
+
_globals['_SLOTKEYROUTE']._serialized_start=130
|
|
33
|
+
_globals['_SLOTKEYROUTE']._serialized_end=209
|
|
34
|
+
_globals['_BYADDRESSROUTE']._serialized_start=211
|
|
35
|
+
_globals['_BYADDRESSROUTE']._serialized_end=255
|
|
36
|
+
_globals['_ROUTES']._serialized_start=258
|
|
37
|
+
_globals['_ROUTES']._serialized_end=504
|
|
38
|
+
_globals['_COMMAND']._serialized_start=507
|
|
39
|
+
_globals['_COMMAND']._serialized_end=689
|
|
40
|
+
_globals['_COMMAND_ARGSARRAY']._serialized_start=656
|
|
41
|
+
_globals['_COMMAND_ARGSARRAY']._serialized_end=681
|
|
42
|
+
_globals['_SCRIPTINVOCATIONPOINTERS']._serialized_start=692
|
|
43
|
+
_globals['_SCRIPTINVOCATIONPOINTERS']._serialized_end=820
|
|
44
|
+
_globals['_SCRIPTINVOCATION']._serialized_start=822
|
|
45
|
+
_globals['_SCRIPTINVOCATION']._serialized_end=882
|
|
46
|
+
_globals['_BATCH']._serialized_start=885
|
|
47
|
+
_globals['_BATCH']._serialized_end=1157
|
|
48
|
+
_globals['_CLUSTERSCAN']._serialized_start=1160
|
|
49
|
+
_globals['_CLUSTERSCAN']._serialized_end=1340
|
|
50
|
+
_globals['_UPDATECONNECTIONPASSWORD']._serialized_start=1342
|
|
51
|
+
_globals['_UPDATECONNECTIONPASSWORD']._serialized_end=1428
|
|
52
|
+
_globals['_REFRESHIAMTOKEN']._serialized_start=1430
|
|
53
|
+
_globals['_REFRESHIAMTOKEN']._serialized_end=1447
|
|
54
|
+
_globals['_COMMANDREQUEST']._serialized_start=1450
|
|
55
|
+
_globals['_COMMANDREQUEST']._serialized_end=2021
|
|
56
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,56 @@
|
|
|
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\"\x8e\x01\n\x12\x41uthenticationInfo\x12\x10\n\x08password\x18\x01 \x01(\t\x12\x10\n\x08username\x18\x02 \x01(\t\x12@\n\x0fiam_credentials\x18\x03 \x01(\x0b\x32\".connection_request.IamCredentialsH\x00\x88\x01\x01\x42\x12\n\x10_iam_credentials\"\xb1\x01\n\x0eIamCredentials\x12\x14\n\x0c\x63luster_name\x18\x01 \x01(\t\x12\x0e\n\x06region\x18\x02 \x01(\t\x12\x35\n\x0cservice_type\x18\x03 \x01(\x0e\x32\x1f.connection_request.ServiceType\x12%\n\x18refresh_interval_seconds\x18\x04 \x01(\rH\x00\x88\x01\x01\x42\x1b\n\x19_refresh_interval_seconds\"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\"\x94\x07\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(\r\x12\x14\n\x0clazy_connect\x18\x11 \x01(\x08\x12+\n#refresh_topology_from_initial_nodes\x18\x12 \x01(\x08\x12\x10\n\x08lib_name\x18\x13 \x01(\t\x12\x12\n\nroot_certs\x18\x14 \x03(\x0c\x42\x11\n\x0fperiodic_checks\"\x8b\x01\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\x12\x1b\n\x0ejitter_percent\x18\x04 \x01(\rH\x00\x88\x01\x01\x42\x11\n\x0f_jitter_percent*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\x0bServiceType\x12\x0f\n\x0b\x45LASTICACHE\x10\x00\x12\x0c\n\x08MEMORYDB\x10\x01*\'\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=1871
|
|
27
|
+
_globals['_READFROM']._serialized_end=1982
|
|
28
|
+
_globals['_TLSMODE']._serialized_start=1984
|
|
29
|
+
_globals['_TLSMODE']._serialized_end=2036
|
|
30
|
+
_globals['_SERVICETYPE']._serialized_start=2038
|
|
31
|
+
_globals['_SERVICETYPE']._serialized_end=2082
|
|
32
|
+
_globals['_PROTOCOLVERSION']._serialized_start=2084
|
|
33
|
+
_globals['_PROTOCOLVERSION']._serialized_end=2123
|
|
34
|
+
_globals['_PUBSUBCHANNELTYPE']._serialized_start=2125
|
|
35
|
+
_globals['_PUBSUBCHANNELTYPE']._serialized_end=2181
|
|
36
|
+
_globals['_NODEADDRESS']._serialized_start=57
|
|
37
|
+
_globals['_NODEADDRESS']._serialized_end=98
|
|
38
|
+
_globals['_AUTHENTICATIONINFO']._serialized_start=101
|
|
39
|
+
_globals['_AUTHENTICATIONINFO']._serialized_end=243
|
|
40
|
+
_globals['_IAMCREDENTIALS']._serialized_start=246
|
|
41
|
+
_globals['_IAMCREDENTIALS']._serialized_end=423
|
|
42
|
+
_globals['_PERIODICCHECKSMANUALINTERVAL']._serialized_start=425
|
|
43
|
+
_globals['_PERIODICCHECKSMANUALINTERVAL']._serialized_end=480
|
|
44
|
+
_globals['_PERIODICCHECKSDISABLED']._serialized_start=482
|
|
45
|
+
_globals['_PERIODICCHECKSDISABLED']._serialized_end=506
|
|
46
|
+
_globals['_PUBSUBCHANNELSORPATTERNS']._serialized_start=508
|
|
47
|
+
_globals['_PUBSUBCHANNELSORPATTERNS']._serialized_end=564
|
|
48
|
+
_globals['_PUBSUBSUBSCRIPTIONS']._serialized_start=567
|
|
49
|
+
_globals['_PUBSUBSUBSCRIPTIONS']._serialized_end=808
|
|
50
|
+
_globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._serialized_start=699
|
|
51
|
+
_globals['_PUBSUBSUBSCRIPTIONS_CHANNELSORPATTERNSBYTYPEENTRY']._serialized_end=808
|
|
52
|
+
_globals['_CONNECTIONREQUEST']._serialized_start=811
|
|
53
|
+
_globals['_CONNECTIONREQUEST']._serialized_end=1727
|
|
54
|
+
_globals['_CONNECTIONRETRYSTRATEGY']._serialized_start=1730
|
|
55
|
+
_globals['_CONNECTIONRETRYSTRATEGY']._serialized_end=1869
|
|
56
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -14,19 +14,19 @@ _sym_db = _symbol_database.Default()
|
|
|
14
14
|
|
|
15
15
|
|
|
16
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\"\
|
|
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\"\x83\x02\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\x12\x1a\n\rroot_span_ptr\x18\x07 \x01(\x04H\x01\x88\x01\x01\x42\x07\n\x05valueB\x10\n\x0e_root_span_ptr*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
18
|
|
|
19
19
|
_globals = globals()
|
|
20
20
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
21
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'protobuf.response_pb2', _globals)
|
|
22
22
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
23
|
DESCRIPTOR._options = None
|
|
24
|
-
_globals['_REQUESTERRORTYPE']._serialized_start=
|
|
25
|
-
_globals['_REQUESTERRORTYPE']._serialized_end=
|
|
26
|
-
_globals['_CONSTANTRESPONSE']._serialized_start=
|
|
27
|
-
_globals['_CONSTANTRESPONSE']._serialized_end=
|
|
24
|
+
_globals['_REQUESTERRORTYPE']._serialized_start=374
|
|
25
|
+
_globals['_REQUESTERRORTYPE']._serialized_end=453
|
|
26
|
+
_globals['_CONSTANTRESPONSE']._serialized_start=455
|
|
27
|
+
_globals['_CONSTANTRESPONSE']._serialized_end=481
|
|
28
28
|
_globals['_REQUESTERROR']._serialized_start=37
|
|
29
29
|
_globals['_REQUESTERROR']._serialized_end=110
|
|
30
30
|
_globals['_RESPONSE']._serialized_start=113
|
|
31
|
-
_globals['_RESPONSE']._serialized_end=
|
|
31
|
+
_globals['_RESPONSE']._serialized_end=372
|
|
32
32
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -5,13 +5,13 @@ from typing import List, Tuple, Type
|
|
|
5
5
|
|
|
6
6
|
from google.protobuf import message
|
|
7
7
|
|
|
8
|
-
"""
|
|
9
|
-
Codec for protobuf messages.
|
|
10
|
-
All of the Varint functions were copied from https://github.com/protocolbuffers/protobuf
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
8
|
|
|
14
9
|
class ProtobufCodec:
|
|
10
|
+
"""
|
|
11
|
+
Codec for protobuf messages.
|
|
12
|
+
All of the Varint functions were copied from [protobuf](https://github.com/protocolbuffers/protobuf)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
15
|
@classmethod
|
|
16
16
|
def _decode_varint_32(cls, buffer, pos):
|
|
17
17
|
decoder_func = cls._varint_decoder((1 << 32) - 1, int)
|
|
@@ -91,7 +91,8 @@ class ProtobufCodec:
|
|
|
91
91
|
# Recieved only partial response
|
|
92
92
|
raise PartialMessageException("Recieved only a partial response")
|
|
93
93
|
offset = new_pos
|
|
94
|
-
|
|
94
|
+
end = offset + msg_len
|
|
95
|
+
msg_buf = read_bytes_view[offset:end]
|
|
95
96
|
offset += msg_len
|
|
96
97
|
message = message_class()
|
|
97
98
|
message.ParseFromString(msg_buf)
|
glide_shared/routes.py
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
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_shared.exceptions import RequestError
|
|
7
|
+
from glide_shared.protobuf.command_request_pb2 import (
|
|
8
|
+
CommandRequest,
|
|
9
|
+
Routes,
|
|
10
|
+
SimpleRoutes,
|
|
11
|
+
)
|
|
12
|
+
from glide_shared.protobuf.command_request_pb2 import SlotTypes as ProtoSlotTypes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SlotType(Enum):
|
|
16
|
+
PRIMARY = 1
|
|
17
|
+
"""
|
|
18
|
+
Address a primary node.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
REPLICA = 2
|
|
22
|
+
"""
|
|
23
|
+
Address a replica node.
|
|
24
|
+
|
|
25
|
+
`REPLICA` overrides the `read_from_replica` configuration. If it's used the request
|
|
26
|
+
will be routed to a replica, even if the strategy is `ALWAYS_FROM_MASTER`.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Route:
|
|
31
|
+
def __init__(self) -> None:
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# cluster routes
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AllNodes(Route):
|
|
39
|
+
"""
|
|
40
|
+
Route request to all nodes.
|
|
41
|
+
|
|
42
|
+
Warning:
|
|
43
|
+
Don't use it with write commands, they could be routed to a replica (RO) node and fail.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AllPrimaries(Route):
|
|
50
|
+
"""
|
|
51
|
+
Route request to all primary nodes.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RandomNode(Route):
|
|
58
|
+
"""
|
|
59
|
+
Route request to a random node.
|
|
60
|
+
|
|
61
|
+
Warning:
|
|
62
|
+
Don't use it with write commands, because they could be randomly routed to a replica (RO) node and fail.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class SlotKeyRoute(Route):
|
|
69
|
+
"""Routes a request to a node by its slot key
|
|
70
|
+
|
|
71
|
+
Attributes:
|
|
72
|
+
slot_type (SlotType): Defines type of the node being addressed.
|
|
73
|
+
slot_key (str): The request will be sent to nodes managing this key.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def __init__(self, slot_type: SlotType, slot_key: str) -> None:
|
|
77
|
+
super().__init__()
|
|
78
|
+
self.slot_type = slot_type
|
|
79
|
+
self.slot_key = slot_key
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class SlotIdRoute(Route):
|
|
83
|
+
"""Routes a request to a node by its slot ID
|
|
84
|
+
|
|
85
|
+
Attributes:
|
|
86
|
+
slot_type (SlotType): Defines type of the node being addressed.
|
|
87
|
+
slot_id (int): Slot number. There are 16384 slots in a Valkey cluster, and each shard
|
|
88
|
+
manages a slot range. Unless the slot is known, it's better to route using
|
|
89
|
+
`SlotType.PRIMARY`
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def __init__(self, slot_type: SlotType, slot_id: int) -> None:
|
|
93
|
+
super().__init__()
|
|
94
|
+
self.slot_type = slot_type
|
|
95
|
+
self.slot_id = slot_id
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class ByAddressRoute(Route):
|
|
99
|
+
"""Routes a request to a node by its address
|
|
100
|
+
|
|
101
|
+
Attributes:
|
|
102
|
+
host (str): The endpoint of the node. If `port` is not provided, should be in the f"{address}:{port}" format,
|
|
103
|
+
where `address` is the preferred endpoint as shown in the output of the `CLUSTER SLOTS` command.
|
|
104
|
+
port (Optional[int]): The port to access on the node. If port is not provided, `host` is assumed to be in
|
|
105
|
+
the format f"{address}:{port}".
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
def __init__(self, host: str, port: Optional[int] = None) -> None:
|
|
109
|
+
super().__init__()
|
|
110
|
+
if port is None:
|
|
111
|
+
split = host.split(":")
|
|
112
|
+
if len(split) < 2:
|
|
113
|
+
raise RequestError(
|
|
114
|
+
"No port provided, expected host to be formatted as {hostname}:{port}`. Received "
|
|
115
|
+
+ host
|
|
116
|
+
)
|
|
117
|
+
self.host = split[0]
|
|
118
|
+
self.port = int(split[1])
|
|
119
|
+
else:
|
|
120
|
+
self.host = host
|
|
121
|
+
self.port = port
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def to_protobuf_slot_type(slot_type: SlotType) -> ProtoSlotTypes.ValueType:
|
|
125
|
+
return (
|
|
126
|
+
ProtoSlotTypes.Primary
|
|
127
|
+
if slot_type == SlotType.PRIMARY
|
|
128
|
+
else ProtoSlotTypes.Replica
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def build_protobuf_route(route: Optional[Route]) -> Optional[Routes]:
|
|
133
|
+
if route is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
protobuf_route = Routes()
|
|
137
|
+
if isinstance(route, AllNodes):
|
|
138
|
+
protobuf_route.simple_routes = SimpleRoutes.AllNodes
|
|
139
|
+
elif isinstance(route, AllPrimaries):
|
|
140
|
+
protobuf_route.simple_routes = SimpleRoutes.AllPrimaries
|
|
141
|
+
elif isinstance(route, RandomNode):
|
|
142
|
+
protobuf_route.simple_routes = SimpleRoutes.Random
|
|
143
|
+
elif isinstance(route, SlotKeyRoute):
|
|
144
|
+
protobuf_route.slot_key_route.slot_type = to_protobuf_slot_type(route.slot_type)
|
|
145
|
+
protobuf_route.slot_key_route.slot_key = route.slot_key
|
|
146
|
+
elif isinstance(route, SlotIdRoute):
|
|
147
|
+
protobuf_route.slot_id_route.slot_type = to_protobuf_slot_type(route.slot_type)
|
|
148
|
+
protobuf_route.slot_id_route.slot_id = route.slot_id
|
|
149
|
+
elif isinstance(route, ByAddressRoute):
|
|
150
|
+
protobuf_route.by_address_route.host = route.host
|
|
151
|
+
protobuf_route.by_address_route.port = route.port
|
|
152
|
+
else:
|
|
153
|
+
raise RequestError(f"Received invalid route type: {type(route)}")
|
|
154
|
+
|
|
155
|
+
return protobuf_route
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def set_protobuf_route(request: CommandRequest, route: Optional[Route]) -> None:
|
|
159
|
+
protobuf_route = build_protobuf_route(route)
|
|
160
|
+
if protobuf_route:
|
|
161
|
+
request.route.CopyFrom(protobuf_route)
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: valkey-glide
|
|
3
|
+
Version: 2.2.3
|
|
4
|
+
Classifier: Topic :: Database
|
|
5
|
+
Classifier: Topic :: Utilities
|
|
6
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Topic :: Software Development
|
|
9
|
+
Classifier: Programming Language :: Rust
|
|
10
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
12
|
+
Requires-Dist: anyio>=4.9.0
|
|
13
|
+
Requires-Dist: protobuf>=6.20
|
|
14
|
+
Requires-Dist: sniffio
|
|
15
|
+
Requires-Dist: typing-extensions>=4.8.0; python_version < '3.11'
|
|
16
|
+
Summary: Valkey GLIDE Async client. Supports Valkey and Redis OSS.
|
|
17
|
+
Author: Valkey GLIDE Maintainers
|
|
18
|
+
License: Apache-2.0
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
21
|
+
|
|
22
|
+
# Welcome to Valkey GLIDE!
|
|
23
|
+
|
|
24
|
+
Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library, proudly part of the Valkey organization. Our mission is to make your experience with Valkey and Redis OSS seamless and enjoyable. Whether you're a seasoned developer or just starting out, Valkey GLIDE is here to support you every step of the way.
|
|
25
|
+
|
|
26
|
+
# Why Choose Valkey GLIDE?
|
|
27
|
+
|
|
28
|
+
- **Community and Open Source**: Join our vibrant community and contribute to the project. We are always here to respond, and the client is for the community.
|
|
29
|
+
- **Reliability**: Built with best practices learned from over a decade of operating Redis OSS-compatible services.
|
|
30
|
+
- **Performance**: Optimized for high performance and low latency.
|
|
31
|
+
- **High Availability**: Designed to ensure your applications are always up and running.
|
|
32
|
+
- **Cross-Language Support**: Implemented using a core driver framework written in Rust, with language-specific extensions to ensure consistency and reduce complexity.
|
|
33
|
+
- **Stability and Fault Tolerance**: We brought our years of experience to create a bulletproof client.
|
|
34
|
+
- **Backed and Supported by AWS and GCP**: Ensuring robust support and continuous improvement of the project.
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
See GLIDE's [documentation site](https://valkey.io/valkey-glide/).
|
|
39
|
+
Visit our [wiki](https://github.com/valkey-io/valkey-glide/wiki/Python-wrapper) for examples and further details on TLS, Read strategy, Timeouts and various other configurations.
|
|
40
|
+
|
|
41
|
+
## Supported Engine Versions
|
|
42
|
+
|
|
43
|
+
Refer to the [Supported Engine Versions table](https://github.com/valkey-io/valkey-glide/blob/main/README.md#supported-engine-versions) for details.
|
|
44
|
+
|
|
45
|
+
# Getting Started - Python Wrapper
|
|
46
|
+
|
|
47
|
+
## System Requirements
|
|
48
|
+
|
|
49
|
+
The release of Valkey GLIDE was tested on the following platforms:
|
|
50
|
+
|
|
51
|
+
Linux:
|
|
52
|
+
|
|
53
|
+
- Ubuntu 20 (x86_64/amd64 and arm64/aarch64)
|
|
54
|
+
- Amazon Linux 2 (AL2) and 2023 (AL2023) (x86_64)
|
|
55
|
+
|
|
56
|
+
**Note: Currently Alpine Linux / MUSL is NOT supported.**
|
|
57
|
+
|
|
58
|
+
macOS:
|
|
59
|
+
|
|
60
|
+
- macOS 14.7 (Apple silicon/aarch_64)
|
|
61
|
+
- macOS 13.7 (x86_64/amd64)
|
|
62
|
+
|
|
63
|
+
## Python Supported Versions
|
|
64
|
+
|
|
65
|
+
| Python Version |
|
|
66
|
+
|----------------|
|
|
67
|
+
| 3.9 |
|
|
68
|
+
| 3.10 |
|
|
69
|
+
| 3.11 |
|
|
70
|
+
| 3.12 |
|
|
71
|
+
| 3.13 |
|
|
72
|
+
|
|
73
|
+
Valkey GLIDE transparently supports both the `asyncio` and `trio` concurrency frameworks.
|
|
74
|
+
|
|
75
|
+
## Installation and Setup
|
|
76
|
+
|
|
77
|
+
### ✅ Async Client
|
|
78
|
+
|
|
79
|
+
To install the async version:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install valkey-glide
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Verify installation:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
python3
|
|
89
|
+
>>> import glide
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### ✅ Sync Client
|
|
93
|
+
|
|
94
|
+
To install the sync version:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install valkey-glide-sync
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Verify installation:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python3
|
|
104
|
+
>>> import glide_sync
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Basic Examples
|
|
110
|
+
|
|
111
|
+
### 🔁 Async Client
|
|
112
|
+
|
|
113
|
+
### ✅ Async Cluster Mode
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import asyncio
|
|
117
|
+
from glide import GlideClusterClientConfiguration, NodeAddress, GlideClusterClient
|
|
118
|
+
|
|
119
|
+
async def test_cluster_client():
|
|
120
|
+
addresses = [NodeAddress("address.example.com", 6379)]
|
|
121
|
+
# It is recommended to set a timeout for your specific use case
|
|
122
|
+
config = GlideClusterClientConfiguration(addresses, request_timeout=500) # 500ms timeout
|
|
123
|
+
client = await GlideClusterClient.create(config)
|
|
124
|
+
set_result = await client.set("foo", "bar")
|
|
125
|
+
print(f"Set response is {set_result}")
|
|
126
|
+
get_result = await client.get("foo")
|
|
127
|
+
print(f"Get response is {get_result}")
|
|
128
|
+
|
|
129
|
+
asyncio.run(test_cluster_client())
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### ✅ Async Standalone Mode
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
import asyncio
|
|
136
|
+
from glide import GlideClientConfiguration, NodeAddress, GlideClient
|
|
137
|
+
|
|
138
|
+
async def test_standalone_client():
|
|
139
|
+
addresses = [
|
|
140
|
+
NodeAddress("server_primary.example.com", 6379),
|
|
141
|
+
NodeAddress("server_replica.example.com", 6379)
|
|
142
|
+
]
|
|
143
|
+
# It is recommended to set a timeout for your specific use case
|
|
144
|
+
config = GlideClientConfiguration(addresses, request_timeout=500) # 500ms timeout
|
|
145
|
+
client = await GlideClient.create(config)
|
|
146
|
+
set_result = await client.set("foo", "bar")
|
|
147
|
+
print(f"Set response is {set_result}")
|
|
148
|
+
get_result = await client.get("foo")
|
|
149
|
+
print(f"Get response is {get_result}")
|
|
150
|
+
|
|
151
|
+
asyncio.run(test_standalone_client())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 🔂 Sync Client
|
|
157
|
+
|
|
158
|
+
#### ✅ Sync Cluster Mode
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from glide_sync import GlideClusterClientConfiguration, NodeAddress, GlideClusterClient
|
|
162
|
+
|
|
163
|
+
def test_cluster_client():
|
|
164
|
+
addresses = [NodeAddress("address.example.com", 6379)]
|
|
165
|
+
# It is recommended to set a timeout for your specific use case
|
|
166
|
+
config = GlideClusterClientConfiguration(addresses, request_timeout=500) # 500ms timeout
|
|
167
|
+
client = GlideClusterClient.create(config)
|
|
168
|
+
set_result = client.set("foo", "bar")
|
|
169
|
+
print(f"Set response is {set_result}")
|
|
170
|
+
get_result = client.get("foo")
|
|
171
|
+
print(f"Get response is {get_result}")
|
|
172
|
+
|
|
173
|
+
test_cluster_client()
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### ✅ Sync Standalone Mode
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from glide_sync import GlideClientConfiguration, NodeAddress, GlideClient
|
|
180
|
+
|
|
181
|
+
def test_standalone_client():
|
|
182
|
+
addresses = [
|
|
183
|
+
NodeAddress("server_primary.example.com", 6379),
|
|
184
|
+
NodeAddress("server_replica.example.com", 6379)
|
|
185
|
+
]
|
|
186
|
+
# It is recommended to set a timeout for your specific use case
|
|
187
|
+
config = GlideClientConfiguration(addresses, request_timeout=500) # 500ms timeout
|
|
188
|
+
client = GlideClient.create(config)
|
|
189
|
+
set_result = client.set("foo", "bar")
|
|
190
|
+
print(f"Set response is {set_result}")
|
|
191
|
+
get_result = client.get("foo")
|
|
192
|
+
print(f"Get response is {get_result}")
|
|
193
|
+
|
|
194
|
+
test_standalone_client()
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
For complete examples with error handling, please refer to:
|
|
200
|
+
- [Async Cluster Example](https://github.com/valkey-io/valkey-glide/blob/main/examples/python/cluster_example.py)
|
|
201
|
+
- [Async Standalone Example](https://github.com/valkey-io/valkey-glide/blob/main/examples/python/standalone_example.py)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Building & Testing
|
|
205
|
+
|
|
206
|
+
Development instructions for local building & testing the package are in the [DEVELOPER.md](https://github.com/valkey-io/valkey-glide/blob/main/python/DEVELOPER.md#build-from-source) file.
|
|
207
|
+
|
|
208
|
+
## Community and Feedback
|
|
209
|
+
|
|
210
|
+
We encourage you to join our community to support, share feedback, and ask questions. You can approach us for anything on our Valkey Slack: [Join Valkey Slack](https://join.slack.com/t/valkey-oss-developer/shared_invite/zt-2nxs51chx-EB9hu9Qdch3GMfRcztTSkQ).
|
|
211
|
+
|