U
    ‰dº  ã                   @   s*   d dl mZ ddlmZ G dd„ dƒZdS )é   )Ú	nativestré   )Úlist_to_dictc                   @   sH   e Zd ZdZg Zg ZdZdZdZdZ	dZ
dZdZdZdZdZdd„ ZdS )ÚTSInfoz¥
    Hold information and statistics on the time-series.
    Can be created using ``tsinfo`` command
    https://oss.redis.com/redistimeseries/commands/#tsinfo.
    Nc                 C   sø   t ttt|ddd… ƒ|ddd… ƒƒ}| d¡| _| d¡| _| d¡| _| d¡| _| d¡| _	t
| d	¡ƒ| _| d
¡| _| d¡| _| d¡| _d|kr¶|d | _| jd | _d|krÈ|d | _d|krô|d | _t| jƒtkrô| j ¡ | _dS )aü  
        Hold information and statistics on the time-series.

        The supported params that can be passed as args:

        rules:
            A list of compaction rules of the time series.
        sourceKey:
            Key name for source time series in case the current series
            is a target of a rule.
        chunkCount:
            Number of Memory Chunks used for the time series.
        memoryUsage:
            Total number of bytes allocated for the time series.
        totalSamples:
            Total number of samples in the time series.
        labels:
            A list of label-value pairs that represent the metadata
            labels of the time series.
        retentionTime:
            Retention time, in milliseconds, for the time series.
        lastTimestamp:
            Last timestamp present in the time series.
        firstTimestamp:
            First timestamp present in the time series.
        maxSamplesPerChunk:
            Deprecated.
        chunkSize:
            Amount of memory, in bytes, allocated for data.
        duplicatePolicy:
            Policy that will define handling of duplicate samples.

        Can read more about on
        https://oss.redis.com/redistimeseries/configuration/#duplicate_policy
        Nr   r   ÚrulesÚ	sourceKeyZ
chunkCountZmemoryUsageZtotalSamplesÚlabelsZretentionTimeZlastTimestampZfirstTimestampZmaxSamplesPerChunké   Ú	chunkSizeZduplicatePolicy)ÚdictÚzipÚmapr   Úgetr   Z
source_keyÚchunk_countÚmemory_usageÚtotal_samplesr   r   Úretention_msecsZlast_timestampZfirst_timestampÚmax_samples_per_chunkÚ
chunk_sizeÚduplicate_policyÚtypeÚbytesÚdecode)ÚselfÚargsÚresponse© r   úB/tmp/pip-unpacked-wheel-f5h5_hbx/redis/commands/timeseries/info.pyÚ__init__   s(    $(
ÿ

zTSInfo.__init__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   Zlast_time_stampZfirst_time_stampr   r   r   r   r   r   r   r   r      s   r   N)Zhelpersr   Úutilsr   r   r   r   r   r   Ú<module>   s   