o
    `šj6	  ã                   @   s$   d dl mZmZ G dd„ deƒZdS )é    )ÚABCÚabstractmethodc                   @   s   e Zd ZdZedd„ ƒZdS )ÚPartitionera
  Base class for pluggable partition selection strategies.

    A :class:`~kafka.KafkaProducer` consults its configured partitioner to
    choose a partition for each record whose ``partition`` was not supplied
    explicitly to :meth:`~kafka.KafkaProducer.send`. Subclass this and
    implement :meth:`partition`, then pass an instance via the
    ``partitioner`` config argument.

    Two built-in implementations are provided: ``DefaultPartitioner``
    (murmur2-hash keyed records, random partition for null keys) and
    ``StickyPartitioner`` (KIP-480; null-key records stick to one partition
    per topic until a new batch is started, then rotate).

    Sticky-style partitioners may additionally implement an optional
    ``on_new_batch(self, topic, cluster, prev_partition)`` hook, which the
    producer calls when a null-key record would have triggered a fresh
    batch, giving the partitioner a chance to rotate off its current sticky
    choice. The hook is looked up with ``getattr``, so it is entirely
    optional.
    c                 C   s   dS )aZ  Choose a partition for a record.

        Arguments:
            topic (str): The topic the record is destined for.
            key: The user-supplied key, before serialization. May be None.
            serialized_key (bytes): The post-serializer key bytes, or None
                when the caller passed ``key=None``.
            value: The user-supplied value, before serialization.
            serialized_value (bytes): The post-serializer value bytes, or
                None when the caller passed ``value=None``.
            cluster (ClusterMetadata): A live cluster snapshot. Use
                ``cluster.partitions_for_topic(topic)`` for all partitions
                and ``cluster.available_partitions_for_topic(topic)`` for
                those whose leader is currently known.

        Returns:
            int: The partition id to assign the record to.

        Raises:
            ValueError: If the topic is not present in cluster metadata.
                Partitioner exceptions surface to the caller via the
                returned :class:`~kafka.producer.future.FutureRecordMetadata`.
        N© )ÚselfÚtopicÚkeyÚserialized_keyÚvalueÚserialized_valueÚclusterr   r   úS/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/kafka/partitioner/abc.pyÚ	partition   s   zPartitioner.partitionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    r   N)Úabcr   r   r   r   r   r   r   Ú<module>   s    