� J�gn{���ddlZddlmZmZmZmZmZmZmZm Z m Z m Z m Z m Z ddlmZddlmZmZddlmZmZmZmZmZmZmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,dd l-m.Z.m/Z/erdd l0m1Z1e2gd ���Z3Gd �d e��Z4Gd�de4��Z5Gd�de'��Z6Gd�de6e!��Z7Gd�de$��Z8Gd�de8e��Z9Gd�de4e6ee)e8e*e%e&e(e/� � Z:Gd�de5e7ee9e#ee e"e.� � Z;dS)�N) � TYPE_CHECKING�Any� AsyncIterator�Dict�Iterable�Iterator�List�Literal�Mapping�NoReturn�Optional�Union)�key_slot)�RedisClusterException� RedisError)�AnyKeyT�ClusterCommandsProtocol� EncodableT�KeysT�KeyT�PatternT� ResponseT�)� ACLCommands�AsyncACLCommands�AsyncDataAccessCommands�AsyncFunctionCommands�AsyncGearsCommands�AsyncManagementCommands�AsyncModuleCommands�AsyncScriptCommands�DataAccessCommands�FunctionCommands� GearsCommands�ManagementCommands�ModuleCommands�PubSubCommands�ScriptCommands)� list_or_args)�AsyncRedisModuleCommands�RedisModuleCommands)� TargetNodesT))�BITCOUNT�BITPOS�EVAL_RO� EVALSHA_RO�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 ���eZdZdZdeedeeeeffd�Z de e e fdeeee ffd�Z dede eee fdeefd �Zdeede eee fd eedeefd �Zded edeeefd �Zde e e fdeefd�Zdededefd�Zdedefd�Zdedefd�Zdedefd�Zdedefd�ZdS)�ClusterMultiKeyCommands�C A class containing commands that handle more than one key �keys�returnc��i}|D]R}t|j�|����}|�|g���|���S|S)z@Split keys into a dictionary that maps a slot to a list of keys.)r�encoder�encode� setdefault�append)�selfrY� slots_to_keys�key�slots �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/redis/commands/cluster.py�_partition_keys_by_slotz/ClusterMultiKeyCommands._partition_keys_by_slotjsb��� �� ;� ;�C��D�L�/�/��4�4�5�5�D� � $� $�T�2� .� .� 5� 5�c� :� :� :� :����mappingc���i}|���D]X}t|j�|d����}|�|g���|���Y|S)zBSplit pairs into a dictionary that maps a slot to a list of pairs.r)�itemsrr\r]r^�extend)r`rg�slots_to_pairs�pairrcs rd�_partition_pairs_by_slotz0ClusterMultiKeyCommands._partition_pairs_by_slottsn�� ���M�M�O�O� =� =�D��D�L�/�/��Q��8�8�9�9�D� � %� %�d�B� /� /� 6� 6�t� <� <� <� <��rf�command� slots_to_argsc��������jo�tv����������fd�|���D������S)Nc �l��g|]0\}}�j�g|�Rd�j�|���gi���1S�� target_nodes��execute_command� nodes_manager�get_node_from_slot��.0rc� slot_argsrn�pipe�read_from_replicasr`s ����rd� <listcomp>zEClusterMultiKeyCommands._execute_pipeline_by_slot.<locals>.<listcomp>��v��� � � � ��i� !�D� �� �� � � ��&�9�9�$�@R�S�S�� � � � � rf)r|� READ_COMMANDS�pipelineri�execute�r`rnror{r|s`` @@rd�_execute_pipeline_by_slotz1ClusterMultiKeyCommands._execute_pipeline_by_slot�s�������"�4�Q��M�9Q���}�}���� � � � � � � �$1�#6�#6�#8�#8� � � � ��|�|�~�~�rf� responsesc�x��d�t|���|��D����fd�|D��S)Nc�F�i|]\}}t||��D]\}}||�� �S�)�zip)ry� slot_values�response�k�vs rd� <dictcomp>zDClusterMultiKeyCommands._reorder_keys_by_command.<locals>.<dictcomp>�sS�� � � �%� �X��K��2�2� � ���1� �q� � � � rfc� ��g|] }�|�� Sr�r�)ryrb�resultss �rdr}zDClusterMultiKeyCommands._reorder_keys_by_command.<locals>.<listcomp>�s���-�-�-���� �-�-�-rf)r��values)r`rYror�r�s @rd�_reorder_keys_by_commandz0ClusterMultiKeyCommands._reorder_keys_by_command�sS���  � �),�]�-A�-A�-C�-C�Y�)O�)O� � � �� .�-�-�-��-�-�-�-rf�argsc��t||��}|�|��}|�d|��}|�|||��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 rF�r)rer�r��r`rYr�ra�ress rd�mget_nonatomicz&ClusterMultiKeyCommands.mget_nonatomic�sY���D�$�'�'���4�4�T�:�:� ��,�,�V�]�C�C���,�,�T�=�#�F�F�Frfc�X�|�|��}|�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�rmr��r`rgrks rd�mset_nonatomicz&ClusterMultiKeyCommands.mset_nonatomic�s/���6�6�w�?�?���-�-�f�n�E�E�Erfc�r�|�|��}t|�||����S)�v Runs the given command once for the keys of each slot. Returns the sum of the return values. �re�sumr��r`rnrYras rd�_split_command_across_slotsz3ClusterMultiKeyCommands._split_command_across_slots�s7���4�4�T�:�:� ��4�1�1�'�=�I�I�J�J�Jrfc��|jdg|�R�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 r1�r��r`rYs rd�existszClusterMultiKeyCommands.exists�s��0�t�/��@�4�@�@�@�@rfc��|jdg|�R�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-existent keys are ignored. Returns the number of keys that were deleted. For more information see https://redis.io/commands/del �DELr�r�s rd�deletezClusterMultiKeyCommands.delete�s��0�t�/��=��=�=�=�=rfc��|jdg|�R�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-existent keys are ignored. Returns the number of keys that were touched. For more information see https://redis.io/commands/touch �TOUCHr�r�s rd�touchzClusterMultiKeyCommands.touch�s��0�t�/��?�$�?�?�?�?rfc��|jdg|�R�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-existent keys are ignored. Returns the number of keys that were unlinked. For more information see https://redis.io/commands/unlink �UNLINKr�r�s rd�unlinkzClusterMultiKeyCommands.unlink�s��0�t�/��@�4�@�@�@�@rfN)�__name__� __module__� __qualname__�__doc__rrr�intr rer rrrm�strrr�r�rr r��boolr�r�rr�r�r�r�r�rfrdrWrWes]���������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�G�G�G�.F�g�g�z�.A�&B�F�t�D�z�F�F�F�F�& K�3� K�t� K�� K� K� K� K�A�D�A�Y�A�A�A�A� >�D� >�Y� >� >� >� >� @�4� @�I� @� @� @� @� A�D� A�Y� A� A� A� A� A� ArfrWc��eZdZdZdededeeefd�Z de e e fdee fd�Zdededefd �Zded e eee fdeefd �Zd S) �AsyncClusterMultiKeyCommandsrXrYr�rZc��K�t||��}|�|��}|�d|���d{V��}|�|||��S)r�rFNr�r�s rdr�z+AsyncClusterMultiKeyCommands.mget_nonatomicso�����D�$�'�'���4�4�T�:�:� ��2�2�6�=�I�I�I�I�I�I�I�I���,�,�T�=�#�F�F�Frfrgc��hK�|�|��}|�d|���d{V��S)r�r�Nr�r�s rdr�z+AsyncClusterMultiKeyCommands.mset_nonatomic%sE�����6�6�w�?�?���3�3�F�N�K�K�K�K�K�K�K�K�Krfrnc��K�|�|��}t|�||���d{V����S)r�Nr�r�s rdr�z8AsyncClusterMultiKeyCommands._split_command_across_slots8sM�����4�4�T�:�:� ���7�7���O�O�O�O�O�O�O�O�P�P�Prfroc������K��jr�����d{V���jo�tv����������fd�|���D�������d{V��S)Nc �l��g|]0\}}�j�g|�Rd�j�|���gi���1Srrrtrxs ����rdr}zJAsyncClusterMultiKeyCommands._execute_pipeline_by_slot.<locals>.<listcomp>Kr~rf)� _initialize� initializer|rr�rir�r�s`` @@rdr�z6AsyncClusterMultiKeyCommands._execute_pipeline_by_slotDs��������� � � $��/�/�#�#� #� #� #� #� #� #� #�!�4�Q��M�9Q���}�}���� � � � � � � �$1�#6�#6�#8�#8� � � � ��\�\�^�^�#�#�#�#�#�#�#rfN)r�r�r�r�rrr r rr�r rrr�r�r�r�r�rr�r�rfrdr�r� s���������G��G�t�G��X�c�]�@S�G�G�G�G�.L�G�G�Z�4G�,H�L�T�RV�Z�L�L�L�L�& Q�� Q�T� Q�c� Q� Q� Q� Q�$��$�+2�3���8L�3L�+M�$� �c��$�$�$�$�$�$rfr�c ���eZdZdZdefd�Zdefd�Zdefd�Zdddefd�Z ddd e defd �Z ddd e defd �Z d e defd �Zdedefd�Zd e deefd�Zd e defd�Z d4dddeedefd�Zd4deddefd�Zdedefd�Z d4dede deddefd�Zdefd�Zdddedefd�Z d5dededdefd �Z d4deddefd!�Zd"e d#e defd$�Z d4d%e deddefd&�Zddded e d'edef d(�Z d e defd)�Z! d4dededdefd*�Z"d4deddefd+�Z#d4d,�Z$d4d-�Z%dddefd.�Z&d4dedddfd/�Z'd4dedddfd0�Z(d4deddefd1�Z)d4deddefd2�Z*defd3�Z+dS)6�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 rZc� �td���)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�r`r��kwargss rd�slaveofz!ClusterManagementCommands.slaveof`s�� $�$N�O�O�Orfc� �td���)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 rd� replicaofz#ClusterManagementCommands.replicaofhs�� $�$P�Q�Q�Qrfc� �td���)zo Swaps two Redis databases. For more information see https://redis.io/commands/swapdb z'SWAPDB is not supported in cluster moder�r�s rd�swapdbz ClusterManagementCommands.swapdbps�� $�$M�N�N�Nrf� target_noder,c�0�|�d|���S)z� Returns the node's id. :target_node: 'ClusterNode' The node to execute the command on For more information check https://redis.io/commands/cluster-myid/ z CLUSTER MYIDrr�ru�r`r�s rd� cluster_myidz&ClusterManagementCommands.cluster_myidxs���#�#�N��#�M�M�Mrf�slotsc�$�|jdg|�Rd|i�S)z� Assign new hash slots to receiving node. Sends to specified node. :target_node: 'ClusterNode' The node to execute the command on For more information see https://redis.io/commands/cluster-addslots zCLUSTER ADDSLOTSrsr��r`r�r�s rd�cluster_addslotsz*ClusterManagementCommands.cluster_addslots�s8��$�t�#� � �!&� � � �5@� � � rfc�$�|jdg|�Rd|i�S)a� Similar to the CLUSTER ADDSLOTS command. The difference between the two commands is that ADDSLOTS takes a list of slots to assign to the node, while ADDSLOTSRANGE takes a list of slot ranges (specified by start and end slots) to assign to the node. :target_node: 'ClusterNode' The node to execute the command on For more information see https://redis.io/commands/cluster-addslotsrange zCLUSTER ADDSLOTSRANGErsr�r�s rd�cluster_addslotsrangez/ClusterManagementCommands.cluster_addslotsrange�s8��$�t�#� #� �&+� � � �:E� � � rf�slot_idc�.�|�d|��S)z� Return the number of local keys in the specified hash slot Send to node based on specified slot_id For more information see https://redis.io/commands/cluster-countkeysinslot zCLUSTER COUNTKEYSINSLOTr��r`r�s rd�cluster_countkeysinslotz1ClusterManagementCommands.cluster_countkeysinslot�s���#�#�$=�w�G�G�Grf�node_idc�.�|�d|��S)z� Return the number of failure reports active for a given node Sends to a random node For more information see https://redis.io/commands/cluster-count-failure-reports zCLUSTER COUNT-FAILURE-REPORTSr�)r`r�s rd�cluster_count_failure_reportz6ClusterManagementCommands.cluster_count_failure_report�s���#�#�$C�W�M�M�Mrfc� ���fd�|D��S)� Set hash slots as unbound in the cluster. It determines by it self what node the slot is in and sends it there Returns a list of the results for each processed slot. For more information see https://redis.io/commands/cluster-delslots c�<��g|]}��d|����S)�CLUSTER DELSLOTSr��ryrcr`s �rdr}z>ClusterManagementCommands.cluster_delslots.<locals>.<listcomp>�s*���Q�Q�Q�4��$�$�%7��>�>�Q�Q�Qrfr��r`r�s` rd�cluster_delslotsz*ClusterManagementCommands.cluster_delslots�s ���R�Q�Q�Q�5�Q�Q�Q�Qrfc��|jdg|�R�S)aQ Similar to the CLUSTER DELSLOTS command. The difference is that CLUSTER DELSLOTS takes a list of hash slots to remove from the node, while CLUSTER DELSLOTSRANGE takes a list of slot ranges to remove from the node. For more information see https://redis.io/commands/cluster-delslotsrange zCLUSTER DELSLOTSRANGEr�r�s rd�cluster_delslotsrangez/ClusterManagementCommands.cluster_delslotsrange�s ��$�t�#�$;�D�e�D�D�D�DrfN�optionc��|r@|���dvrtd|�����|�d||���S|�d|���S)a  Forces a slave to perform a manual failover of its master Sends to specified node :target_node: 'ClusterNode' The node to execute the command on For more information see https://redis.io/commands/cluster-failover )�FORCE�TAKEOVERz-Invalid option for CLUSTER FAILOVER command: zCLUSTER FAILOVERrr)�upperrru)r`r�r�s rd�cluster_failoverz*ClusterManagementCommands.cluster_failover�s��� � V��|�|�~�~�%:�:�:� �L�F�L�L�����+�+�&��[�,�����'�'�(:��'�U�U� Urfrsc�0�|�d|���S)z� Provides info about Redis Cluster node state. The command will be sent to a random node in the cluster if no target node is specified. For more information see https://redis.io/commands/cluster-info z CLUSTER INFOrrr��r`rss rd� cluster_infoz&ClusterManagementCommands.cluster_info�s���#�#�N��#�N�N�Nrfrbc�.�|�d|��S)z� Returns the hash slot of the specified key Sends to random node in the cluster For more information see https://redis.io/commands/cluster-keyslot zCLUSTER KEYSLOTr�)r`rbs rd�cluster_keyslotz)ClusterManagementCommands.cluster_keyslot�s���#�#�$5�s�;�;�;rf�host�portc�4�|�d|||���S)z� Force a node cluster to handshake with another node. Sends to specified node. For more information see https://redis.io/commands/cluster-meet z CLUSTER MEETrrr�)r`r�r�rss rd� cluster_meetz&ClusterManagementCommands.cluster_meet�s*���#�#� �D�$�\�$� � � rfc�,�|�d��S)z� Get Cluster config for the node. Sends to random node in the cluster For more information see https://redis.io/commands/cluster-nodes z CLUSTER NODESr�)r`s rd� cluster_nodesz'ClusterManagementCommands.cluster_nodess���#�#�O�4�4�4rfc�2�|�d||���S)z� Reconfigure a node as a slave of the specified master node For more information see https://redis.io/commands/cluster-replicate zCLUSTER REPLICATErrr�)r`rsr�s rd�cluster_replicatez+ClusterManagementCommands.cluster_replicate s(���#�#� ��|�$� � � rfT�softc�:�|�d|rdnd|���S)z� Reset a Redis Cluster node If 'soft' is True then it will send 'SOFT' argument If 'soft' is False then it will send 'HARD' argument For more information see https://redis.io/commands/cluster-reset z CLUSTER RESETsSOFTsHARDrrr�)r`r�rss rd� cluster_resetz'ClusterManagementCommands.cluster_resets1���#�#� ��9�W�W�'� �$� � � rfc�0�|�d|���S)z� Forces the node to save cluster state on disk For more information see https://redis.io/commands/cluster-saveconfig zCLUSTER SAVECONFIGrrr�r�s rd�cluster_save_configz-ClusterManagementCommands.cluster_save_config(s���#�#�$8�|�#�T�T�Trfrc�num_keysc�0�|�d||��S)z� Returns the number of keys in the specified cluster slot For more information see https://redis.io/commands/cluster-getkeysinslot zCLUSTER GETKEYSINSLOTr�)r`rcrs rd�cluster_get_keys_in_slotz2ClusterManagementCommands.cluster_get_keys_in_slot2s�� �#�#�$;�T�8�L�L�Lrf�epochc�2�|�d||���S)z� Set the configuration epoch in a new node For more information see https://redis.io/commands/cluster-set-config-epoch zCLUSTER SET-CONFIG-EPOCHrrr�)r`rrss rd�cluster_set_config_epochz2ClusterManagementCommands.cluster_set_config_epoch:s(���#�#� &��L�$� � � rf�statec���|���dvr|�d||||���S|���dkrtd���td|�����)z� Bind an hash slot to a specific node :target_node: 'ClusterNode' The node to execute the command on For more information see https://redis.io/commands/cluster-setslot )� IMPORTING�NODE� MIGRATING�CLUSTER SETSLOTrr�STABLEz4For "stable" state please use cluster_setslot_stablezInvalid slot state: )r�rur)r`r�r�r�rs rd�cluster_setslotz)ClusterManagementCommands.cluster_setslotFs{�� �;�;�=�=�>� >� >��'�'�!�7�E�7��(��� ��[�[�]�]�h� &� &��V�W�W� W��;�E�;�;�<�<� <rfc�0�|�d|d��S)z� Clears migrating / importing state from the slot. It determines by it self what node the slot is in and sends it there. For more information see https://redis.io/commands/cluster-setslot r r r�r�s rd�cluster_setslot_stablez0ClusterManagementCommands.cluster_setslot_stableZs���#�#�$5�w��I�I�Irfc�2�|�d||���S)z� Provides a list of replica nodes replicating from the specified primary target node. For more information see https://redis.io/commands/cluster-replicas zCLUSTER REPLICASrrr�)r`r�rss rd�cluster_replicasz*ClusterManagementCommands.cluster_replicascs(���#�#� ��l�$� � � rfc�0�|�d|���S)z� Get array of Cluster slot to node mappings For more information see https://redis.io/commands/cluster-slots z CLUSTER SLOTSrrr�r�s rd� cluster_slotsz'ClusterManagementCommands.cluster_slotsps�� �#�#�O�,�#�O�O�Orfc�0�|�d|���S)z� Returns details about the shards of the cluster. For more information see https://redis.io/commands/cluster-shards zCLUSTER SHARDSrrr�r�s rd�cluster_shardsz(ClusterManagementCommands.cluster_shardsxs�� �#�#�$4�<�#�P�P�Prfc�0�|�d|���S)z� Returns the shard ID of the node. For more information see https://redis.io/commands/cluster-myshardid/ zCLUSTER MYSHARDIDrrr�r�s rd�cluster_myshardidz+ClusterManagementCommands.cluster_myshardid�s�� �#�#�$7�l�#�S�S�Srfc�0�|�d|���S)a� Each node in a Redis Cluster maintains a pair of long-lived TCP link with each peer in the cluster: One for sending outbound messages towards the peer and one for receiving inbound messages from the peer. This command outputs information of all such peer links as an array. For more information see https://redis.io/commands/cluster-links z CLUSTER LINKSrrr�r�s rd� cluster_linksz'ClusterManagementCommands.cluster_links�s���#�#�O�+�#�N�N�Nrfc� �td���)NzBCLUSTER FLUSHSLOTS is intentionally not implemented in the client.��NotImplementedErrorr�s rd�cluster_flushslotsz,ClusterManagementCommands.cluster_flushslots�s��!� P� � � rfc� �td���)NzACLUSTER BUMPEPOCH is intentionally not implemented in the client.rr�s rd�cluster_bumpepochz+ClusterManagementCommands.cluster_bumpepoch�s��!� O� � � rfc�V�|dks|dkrd|_|�d|���S)z� Enables read queries. The command will be sent to the default cluster node if target_nodes is not specified. For more information see https://redis.io/commands/readonly �replicas�allT�READONLYrr�r|rur�s rd�readonlyz"ClusterManagementCommands.readonly�s<�� �:� %� %���)>�)>�'+�D� #��#�#�J�\�#�J�J�Jrfc�>�d|_|�d|���S)z� Disables read queries. The command will be sent to the default cluster node if target_nodes is not specified. For more information see https://redis.io/commands/readwrite F� READWRITErrr%r�s rd� readwritez#ClusterManagementCommands.readwrite�s%��#(����#�#�K�l�#�K�K�Krfc ��|jdi|��S)zl On an OSS cluster, before executing any gears function, you must call this command. # noqa �REDISGEARS_2.REFRESHCLUSTER)r+r�)r`r�s rd�gears_refresh_clusterz/ClusterManagementCommands.gears_refresh_cluster�s��$�t�#�L�L�V�L�L�Lrf)N)TN),r�r�r�r�r r�r�r�rr�rr�r�r�r�r�r�r r�r�r�r r�r�r�r�r�r�r�rrrrrrrrrrrr r&r)r,r�rfrdr�r�Xs���������P�(�P�P�P�P�R�H�R�R�R�R�O��O�O�O�O� N�� N�9� N� N� N� N�  �)�  �3=�  � �  �  �  �  � �)� �3=� � � � � � �$H�s�H�y�H�H�H�H�N�C�N�I�N�N�N�N� R�z� R�d�4�j� R� R� R� R� E�J� E�9� E� E� E� E�DH�V�V�)�V�3;�C�=�V� �V�V�V�V�0O�O��.�)A�O�Y�O�O�O�O�<�3�<�9�<�<�<�<�NR�  �  ��  �"�  �2:�>�2J�  � �  �  �  �  �5�y�5�5�5�5�  �*�  �58�  � �  �  �  �  �KO�  �  ��  �/7��/G�  � �  �  �  �  � 8<�U�U�$�^�4�U� �U�U�U�U�M�S�M�C�M�I�M�M�M�M�DH�  �  ��  �(0��(@�  � �  �  �  �  �=�)�=�47�=�BE�=�NQ�=� �=�=�=�=�(J�c�J�i�J�J�J�J�FJ�  �  ��  �*2�>�*B�  � �  �  �  �  �P�P�(�>�*B�P�i�P�P�P�P�Q�Q�Q�Q�T�T�T�T� O�� O�I� O� O� O� O� � �x��/G� �SW� � � � �  � �h�~�.F� �RV� � � � � K� K�X�n�%=� K�� K� K� K� K� L� L�h�~�&>� L�)� L� L� L� L�M��M�M�M�M�M�Mrfr�c�.�eZdZdZdedeefd�ZdS)�AsyncClusterManagementCommandsr�r�rZc��H�K�tj�fd�|D����d{V��S)r�c3�h�K�|],}tj��d|����V��-dS)r�N)�asyncio� create_taskrur�s �rd� <genexpr>zBAsyncClusterManagementCommands.cluster_delslots.<locals>.<genexpr>�sS���������#�D�$8�$8�9K�T�$R�$R�S�S������rfN)r1�gatherr�s` rdr�z/AsyncClusterManagementCommands.cluster_delslots�s\������^�����!���� � � � � � � � rfN)r�r�r�r�rr r�r�r�rfrdr.r.�sD�������� �Z� �D��J� � � � � � rfr.c����eZdZdZ ddeddeded eeded fd ed ed ee dede f�fd� Z ddee dee dee defd�Z�xZS)�ClusterDataAccessCommands�� A class for Redis Cluster Data Access Commands The class inherits from Redis's core DataAccessCommand class and do the required adjustments to work with cluster mode �stringsFN�algo�LCS�value1�value2�specific_argumentrY�len�idx� minmatchlen� withmatchlenrZc ���| �dd��} |dkr| �d} | �d| i��t��j||||||||fi| ��S)a� Implements complex algorithms that operate on strings. Right now the only algorithm implemented is the LCS algorithm (longest common substring). However new algorithms could be implemented in the future. ``algo`` Right now must be LCS ``value1`` and ``value2`` Can be two strings or two keys ``specific_argument`` Specifying if the arguments to the algorithm will be keys or strings. strings is the default. ``len`` Returns just the len of the match. ``idx`` Returns the match positions in each string. ``minmatchlen`` Restrict the list of matches to the ones of a given minimal length. Can be provided only when ``idx`` set to True. ``withmatchlen`` Returns the matches with the len of the match. Can be provided only when ``idx`` set to True. For more information see https://redis.io/commands/stralgo rsNr8z default-node)�pop�update�super�stralgo) r`r9r;r<r=r>r?r@rAr�rs� __class__s �rdrFz!ClusterDataAccessCommands.stralgo�s����>�z�z�.�$�7�7� � � � )� )�l�.B�)�L�� � �~�|�4�5�5�5��u�w�w�� � � � � � � � �  �  ��  �  � rf�match�count�_typec +���K��jd|||d�|��\}}|Ed{V��d�|���D��}|r��fd�|���D��}|�dd��|rm|���D]4\}} �jd| |||||d�|��\} }|Ed{V��| |||<�5d�|���D��}|�idSdSdS)N�rHrIrJc�&�i|]\}}|dk� ||��S�rr��ry�name�cursors rdr�z7ClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>�$��S�S�S�L�D�&�v�QR�{�{�4��{�{�{rfc�>��i|]}|��|�����S�)� node_name��get_node�ryrPr`s �rdr�z7ClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>�)���T�T�T�T�T�4�=�=�4�=�8�8�T�T�Trfrs�rQrHrIrJrsc�&�i|]\}}|dk� ||��SrNr�rOs rdr�z7ClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>0�+�����%1�T�6��RS� � �D�&� � � rfr���scanrirYrC) r`rHrIrJr��cursors�data�nodesrPrQ�curs ` rd� scan_iterz#ClusterDataAccessCommands.scan_itersi�����"�� �R��U�%�R�R�6�R�R� �����������S�S�G�M�M�O�O�S�S�S�� � �T�T�T�T�W�\�\�^�^�T�T�T�E� �J�J�~�t� ,� ,� ,�� �$+�M�M�O�O� .� .�L�D�&� )�� �!�%�#�#�#�%*�4�[� !�!� !� !�!�I�C�� $�O�O�O�O�O�O�O�$'��I�G�D�M�M���5<�]�]�_�_������ � � �  � �  � rf)r8FFNF�NNN)r�r�r�r�r rrr�r r�rrFrr�rrc� __classcell__)rGs@rdr6r6�s*���������IR���%)�"�- �- ��e�n�- ��- �� - � !���!3�W�V�_�!D�E� - � � - ��- ��c�]�- ��- � �- �- �- �- �- �- �b%)�#�#� !�!���!�!���}�!���}� !� � !�!�!�!�!�!�!�!rfr6c �V�eZdZdZ ddeedeedeedefd�Z dS) �AsyncClusterDataAccessCommandsr7NrHrIrJrZc ���K��jd|||d�|���d{V��\}}|D]}|WV��d�|���D��}|r��fd�|���D��}|�dd��|ru|���D]<\} } �jd| ||||| d�|���d{V��\} }|D]}|WV��| | || <�=d�|���D��}|�qdSdSdS)NrLc�&�i|]\}}|dk� ||��SrNr�rOs rdr�z<AsyncClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>KrRrfc�>��i|]}|��|�����SrTrVrXs �rdr�z<AsyncClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>NrYrfrsrZc�&�i|]\}}|dk� ||��SrNr�rOs rdr�z<AsyncClusterDataAccessCommands.scan_iter.<locals>.<dictcomp>`r\rfr�r]) r`rHrIrJr�r_r`�valuerarPrQrbs ` rdrcz(AsyncClusterDataAccessCommands.scan_iter?s������(�d�i�X�e�5��X�X�QW�X�X�X�X�X�X�X�X� ���� � �E��K�K�K�K�K�S�S�G�M�M�O�O�S�S�S�� � �T�T�T�T�W�\�\�^�^�T�T�T�E� �J�J�~�t� ,� ,� ,�� �$+�M�M�O�O� .� .�L�D�&�&/�d�i�'�%�#�#�#�%*�4�[� '�'� !� '�'�!�!�!�!�!�!�I�C��"&�$�$��#� � � � � �$'��I�G�D�M�M���5<�]�]�_�_������ � � �  � �  � rfrd) r�r�r�r�r rr�r�rrcr�rfrdrgrg5su��������%)�#�#� #�#���!�#���}�#���}� #� � #�#�#�#�#�#rfrgc��eZdZdZdS)�RedisClusterCommands� A class for all Redis Cluster commands For key-based commands, the target node(s) will be internally determined by the keys' hash slot. Non-key-based commands can be executed with the 'target_nodes' argument to target specific nodes. By default, if target_nodes is not specified, the command will be executed on the default cluster node. :param :target_nodes: type can be one of the followings: - nodes flag: ALL_NODES, PRIMARIES, REPLICAS, RANDOM - 'ClusterNode' - 'list(ClusterNodes)' - 'dict(any:clusterNodes)' for example: r.cluster_info(target_nodes=RedisCluster.ALL_NODES) N�r�r�r�r�r�rfrdrnrnes���������rfrnc��eZdZdZdS)�AsyncRedisClusterCommandsroNrpr�rfrdrrrr�s���������rfrr)<r1�typingrrrrrrr r r r r r� redis.crcr�redis.exceptionsrr� redis.typingrrrrrrr�corerrrrrrr r!r"r#r$r%r&r'r(�helpersr)� redismodulesr*r+�redis.asyncio.clusterr,� frozensetrrWr�r�r.r6rgrnrrr�rfrd�<module>r|s������ � � � � � � � � � � � � � � � � � � � � � � � � � � � �������>�>�>�>�>�>�>�>�����������������������������������������������������""�!�!�!�!�!�G�G�G�G�G�G�G�G��3�2�2�2�2�2�2�� �*�*�*�,�,� �^aA�aA�aA�aA�aA�5�aA�aA�aA�HL$�L$�L$�L$�L$�#:�L$�L$�L$�^dM�dM�dM�dM�dM� 2�dM�dM�dM�N  � � � � ��6� � � �6X�X�X�X�X� 2�X�X�X�v-�-�-�-�-��6�-�-�-�`������������������@����� �"��"����������rf
Memory