valkey-glide 2.2.1rc3__cp314-cp314-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 +388 -0
- glide/async_commands/__init__.py +5 -0
- glide/async_commands/cluster_commands.py +1476 -0
- glide/async_commands/core.py +7818 -0
- glide/async_commands/ft.py +465 -0
- glide/async_commands/glide_json.py +1269 -0
- glide/async_commands/standalone_commands.py +1001 -0
- glide/glide.cpython-314-darwin.so +0 -0
- glide/glide.pyi +61 -0
- glide/glide_client.py +821 -0
- glide/logger.py +97 -0
- glide/opentelemetry.py +185 -0
- glide/py.typed +0 -0
- glide_shared/__init__.py +330 -0
- glide_shared/commands/__init__.py +0 -0
- glide_shared/commands/batch.py +5997 -0
- glide_shared/commands/batch_options.py +261 -0
- glide_shared/commands/bitmap.py +320 -0
- glide_shared/commands/command_args.py +103 -0
- glide_shared/commands/core_options.py +407 -0
- glide_shared/commands/server_modules/ft_options/ft_aggregate_options.py +300 -0
- glide_shared/commands/server_modules/ft_options/ft_constants.py +84 -0
- glide_shared/commands/server_modules/ft_options/ft_create_options.py +423 -0
- glide_shared/commands/server_modules/ft_options/ft_profile_options.py +113 -0
- glide_shared/commands/server_modules/ft_options/ft_search_options.py +139 -0
- glide_shared/commands/server_modules/json_batch.py +820 -0
- glide_shared/commands/server_modules/json_options.py +93 -0
- glide_shared/commands/sorted_set.py +412 -0
- glide_shared/commands/stream.py +449 -0
- glide_shared/config.py +975 -0
- glide_shared/constants.py +124 -0
- glide_shared/exceptions.py +88 -0
- glide_shared/protobuf/command_request_pb2.py +56 -0
- glide_shared/protobuf/connection_request_pb2.py +56 -0
- glide_shared/protobuf/response_pb2.py +32 -0
- glide_shared/protobuf_codec.py +110 -0
- glide_shared/routes.py +161 -0
- valkey_glide-2.2.1rc3.dist-info/METADATA +210 -0
- valkey_glide-2.2.1rc3.dist-info/RECORD +40 -0
- valkey_glide-2.2.1rc3.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
from typing import List, Mapping, Optional
|
|
4
|
+
|
|
5
|
+
from glide_shared.commands.server_modules.ft_options.ft_constants import (
|
|
6
|
+
FtSearchKeywords,
|
|
7
|
+
)
|
|
8
|
+
from glide_shared.constants import TEncodable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FtSearchLimit:
|
|
12
|
+
"""
|
|
13
|
+
This class represents the arguments for the LIMIT option of the FT.SEARCH command.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, offset: int, count: int):
|
|
17
|
+
"""
|
|
18
|
+
Initialize a new FtSearchLimit instance.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
offset (int): The number of keys to skip before returning the result for the FT.SEARCH command.
|
|
22
|
+
count (int): The total number of keys to be returned by FT.SEARCH command.
|
|
23
|
+
"""
|
|
24
|
+
self.offset = offset
|
|
25
|
+
self.count = count
|
|
26
|
+
|
|
27
|
+
def to_args(self) -> List[TEncodable]:
|
|
28
|
+
"""
|
|
29
|
+
Get the arguments for the LIMIT option of FT.SEARCH.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List[TEncodable]: A list of LIMIT option arguments.
|
|
33
|
+
"""
|
|
34
|
+
args: List[TEncodable] = [
|
|
35
|
+
FtSearchKeywords.LIMIT,
|
|
36
|
+
str(self.offset),
|
|
37
|
+
str(self.count),
|
|
38
|
+
]
|
|
39
|
+
return args
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ReturnField:
|
|
43
|
+
"""
|
|
44
|
+
This class represents the arguments for the RETURN option of the FT.SEARCH command.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(
|
|
48
|
+
self, field_identifier: TEncodable, alias: Optional[TEncodable] = None
|
|
49
|
+
):
|
|
50
|
+
"""
|
|
51
|
+
Initialize a new ReturnField instance.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
field_identifier (TEncodable): The identifier for the field of the key that has to returned as a result of
|
|
55
|
+
FT.SEARCH command.
|
|
56
|
+
alias (Optional[TEncodable]): The alias to override the name of the field in the FT.SEARCH result.
|
|
57
|
+
"""
|
|
58
|
+
self.field_identifier = field_identifier
|
|
59
|
+
self.alias = alias
|
|
60
|
+
|
|
61
|
+
def to_args(self) -> List[TEncodable]:
|
|
62
|
+
"""
|
|
63
|
+
Get the arguments for the RETURN option of FT.SEARCH.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
List[TEncodable]: A list of RETURN option arguments.
|
|
67
|
+
"""
|
|
68
|
+
args: List[TEncodable] = [self.field_identifier]
|
|
69
|
+
if self.alias:
|
|
70
|
+
args.append(FtSearchKeywords.AS)
|
|
71
|
+
args.append(self.alias)
|
|
72
|
+
return args
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class FtSearchOptions:
|
|
76
|
+
"""
|
|
77
|
+
This class represents the input options to be used in the FT.SEARCH command.
|
|
78
|
+
All fields in this class are optional inputs for FT.SEARCH.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
return_fields: Optional[List[ReturnField]] = None,
|
|
84
|
+
timeout: Optional[int] = None,
|
|
85
|
+
params: Optional[Mapping[TEncodable, TEncodable]] = None,
|
|
86
|
+
limit: Optional[FtSearchLimit] = None,
|
|
87
|
+
count: Optional[bool] = False,
|
|
88
|
+
):
|
|
89
|
+
"""
|
|
90
|
+
Initialize the FT.SEARCH optional fields.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
return_fields (Optional[List[ReturnField]]): The fields of a key that are returned by FT.SEARCH command.
|
|
94
|
+
See `ReturnField`.
|
|
95
|
+
timeout (Optional[int]): This value overrides the timeout parameter of the module.
|
|
96
|
+
The unit for the timout is in milliseconds.
|
|
97
|
+
params (Optional[Mapping[TEncodable, TEncodable]]): Param key/value pairs that can be referenced from within the
|
|
98
|
+
query expression.
|
|
99
|
+
limit (Optional[FtSearchLimit]): This option provides pagination capability. Only the keys that satisfy the offset
|
|
100
|
+
and count values are returned. See `FtSearchLimit`.
|
|
101
|
+
count (Optional[bool]): This flag option suppresses returning the contents of keys.
|
|
102
|
+
Only the number of keys is returned.
|
|
103
|
+
"""
|
|
104
|
+
self.return_fields = return_fields
|
|
105
|
+
self.timeout = timeout
|
|
106
|
+
self.params = params
|
|
107
|
+
self.limit = limit
|
|
108
|
+
self.count = count
|
|
109
|
+
|
|
110
|
+
def to_args(self) -> List[TEncodable]:
|
|
111
|
+
"""
|
|
112
|
+
Get the optional arguments for the FT.SEARCH command.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
List[TEncodable]:
|
|
116
|
+
List of FT.SEARCH optional agruments.
|
|
117
|
+
"""
|
|
118
|
+
args: List[TEncodable] = []
|
|
119
|
+
if self.return_fields:
|
|
120
|
+
args.append(FtSearchKeywords.RETURN)
|
|
121
|
+
return_field_args: List[TEncodable] = []
|
|
122
|
+
for return_field in self.return_fields:
|
|
123
|
+
return_field_args.extend(return_field.to_args())
|
|
124
|
+
args.append(str(len(return_field_args)))
|
|
125
|
+
args.extend(return_field_args)
|
|
126
|
+
if self.timeout:
|
|
127
|
+
args.append(FtSearchKeywords.TIMEOUT)
|
|
128
|
+
args.append(str(self.timeout))
|
|
129
|
+
if self.params:
|
|
130
|
+
args.append(FtSearchKeywords.PARAMS)
|
|
131
|
+
args.append(str(len(self.params) * 2))
|
|
132
|
+
for name, value in self.params.items():
|
|
133
|
+
args.append(name)
|
|
134
|
+
args.append(value)
|
|
135
|
+
if self.limit:
|
|
136
|
+
args.extend(self.limit.to_args())
|
|
137
|
+
if self.count:
|
|
138
|
+
args.append(FtSearchKeywords.COUNT)
|
|
139
|
+
return args
|