Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/__pycache__/cluster.cpython-35.pyc



�(Z��@s'ddlmZGdd�d�ZdS)�)�wait_okc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdddd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(S))�ClusterCommandsMixinz\Cluster commands mixin.

    For commands details see: http://redis.io/commands#cluster
    cGsQ|f|}tdd�|D��s2td��|jdd|�}t|�S)z(Assign new hash slots to receiving node.css|]}t|t�VqdS)N)�
isinstance�int)�.0�s�r�J/opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/cluster.py�	<genexpr>
sz9ClusterCommandsMixin.cluster_add_slots.<locals>.<genexpr>z"All parameters must be of type intsCLUSTERsADDSLOTS)�all�	TypeError�executer)�self�slot�slots�futrrr	�cluster_add_slots
s

z&ClusterCommandsMixin.cluster_add_slotscCs|jdd|�S)z=Return the number of failure reports active for a given node.sCLUSTERsCOUNT-FAILURE-REPORTS)r
)r�node_idrrr	�cluster_count_failure_reportssz2ClusterCommandsMixin.cluster_count_failure_reportscCs=t|t�s*tdjt|����|jdd|�S)z;Return the number of local keys in the specified hash slot.z'Expected slot to be of type int, got {}sCLUSTERsCOUNTKEYSINSLOT)rrr�format�typer
)rrrrr	�cluster_count_key_in_slotss	z/ClusterCommandsMixin.cluster_count_key_in_slotscGsQ|f|}tdd�|D��s2td��|jdd|�}t|�S)z,Set hash slots as unbound in receiving node.css|]}t|t�VqdS)N)rr)rrrrr	r
!sz9ClusterCommandsMixin.cluster_del_slots.<locals>.<genexpr>z"All parameters must be of type intsCLUSTERsDELSLOTS)rrr
r)rrrrrrr	�cluster_del_slotss

z&ClusterCommandsMixin.cluster_del_slotscCsdS)z:Forces a slave to perform a manual failover of its master.Nr)rrrr	�cluster_failover&sz%ClusterCommandsMixin.cluster_failovercCs|jdd|�}t|�S)z#Remove a node from the nodes table.sCLUSTERsFORGET)r
r)rrrrrr	�cluster_forget*sz#ClusterCommandsMixin.cluster_forgetcCs|jdd||d|�S)z2Return local key names in the specified hash slot.sCLUSTERs
GETKEYSINSLOT�encoding)r
)rr�countrrrr	�cluster_get_keys_in_slots/sz.ClusterCommandsMixin.cluster_get_keys_in_slotscCsdS)z-Provides info about Redis Cluster node state.Nr)rrrr	�cluster_info4sz!ClusterCommandsMixin.cluster_infocCs|jdd|�S)z+Returns the hash slot of the specified key.sCLUSTERsKEYSLOT)r
)r�keyrrr	�cluster_keyslot8sz$ClusterCommandsMixin.cluster_keyslotcCs"|jdd||�}t|�S)z4Force a node cluster to handshake with another node.sCLUSTERsMEET)r
r)rZip�portrrrr	�cluster_meet<sz!ClusterCommandsMixin.cluster_meetcCsdS)z Get Cluster config for the node.Nr)rrrr	�
cluster_nodesAsz"ClusterCommandsMixin.cluster_nodescCs|jdd|�}t|�S)z;Reconfigure a node as a slave of the specified master node.sCLUSTERs	REPLICATE)r
r)rrrrrr	�cluster_replicateEsz&ClusterCommandsMixin.cluster_replicate�hardFcCs1|rdpd}|jdd|�}t|�S)zReset a Redis Cluster node.sHARDsSOFTsCLUSTERsRESET)r
r)rr%�resetrrrr	�
cluster_resetJsz"ClusterCommandsMixin.cluster_resetcCs|jdd�}t|�S)z-Force the node to save cluster state on disk.sCLUSTERs
SAVECONFIG)r
r)rrrrr	�cluster_save_configPsz(ClusterCommandsMixin.cluster_save_configcCs|jdd|�}t|�S)z*Set the configuration epoch in a new node.sCLUSTERsSET-CONFIG-EPOCH)r
r)rZconfig_epochrrrr	�cluster_set_config_epochUsz-ClusterCommandsMixin.cluster_set_config_epochcCsdS)z#Bind a hash slot to specified node.Nr)rr�commandrrrr	�cluster_setslotZsz$ClusterCommandsMixin.cluster_setslotcCsdS)z.List slave nodes of the specified master node.Nr)rrrrr	�cluster_slaves^sz#ClusterCommandsMixin.cluster_slavescCsdS)z+Get array of Cluster slot to node mappings.Nr)rrrr	�
cluster_slotsbsz"ClusterCommandsMixin.cluster_slotsN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr r"r#r$r'r(r)r+r,r-rrrr	rs&rN)Z
aioredis.utilrrrrrr	�<module>s