Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/confluent_kafka/_model/__init__.py: 58%
24 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:36 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:36 +0000
1# Copyright 2022 Confluent Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
15from enum import Enum
16from .. import cimpl
19class Node:
20 """
21 Represents node information.
22 Used by :class:`ConsumerGroupDescription`
24 Parameters
25 ----------
26 id: int
27 The node id of this node.
28 id_string:
29 String representation of the node id.
30 host:
31 The host name for this node.
32 port: int
33 The port for this node.
34 rack: str
35 The rack for this node.
36 """
37 def __init__(self, id, host, port, rack=None):
38 self.id = id
39 self.id_string = str(id)
40 self.host = host
41 self.port = port
42 self.rack = rack
45class ConsumerGroupTopicPartitions:
46 """
47 Represents consumer group and its topic partition information.
48 Used by :meth:`AdminClient.list_consumer_group_offsets` and
49 :meth:`AdminClient.alter_consumer_group_offsets`.
51 Parameters
52 ----------
53 group_id: str
54 Id of the consumer group.
55 topic_partitions: list(TopicPartition)
56 List of topic partitions information.
57 """
58 def __init__(self, group_id, topic_partitions=None):
59 self.group_id = group_id
60 self.topic_partitions = topic_partitions
63class ConsumerGroupState(Enum):
64 """
65 Enumerates the different types of Consumer Group State.
67 Values
68 ------
69 UNKOWN : State is not known or not set.
70 PREPARING_REBALANCING : Preparing rebalance for the consumer group.
71 COMPLETING_REBALANCING : Consumer Group is completing rebalancing.
72 STABLE : Consumer Group is stable.
73 DEAD : Consumer Group is Dead.
74 EMPTY : Consumer Group is Empty.
75 """
76 UNKOWN = cimpl.CONSUMER_GROUP_STATE_UNKNOWN
77 PREPARING_REBALANCING = cimpl.CONSUMER_GROUP_STATE_PREPARING_REBALANCE
78 COMPLETING_REBALANCING = cimpl.CONSUMER_GROUP_STATE_COMPLETING_REBALANCE
79 STABLE = cimpl.CONSUMER_GROUP_STATE_STABLE
80 DEAD = cimpl.CONSUMER_GROUP_STATE_DEAD
81 EMPTY = cimpl.CONSUMER_GROUP_STATE_EMPTY
83 def __lt__(self, other):
84 if self.__class__ != other.__class__:
85 return NotImplemented
86 return self.value < other.value