예제 #1
0
class ApiVersionResponse_v1(Response):
    API_KEY = 18
    API_VERSION = 1
    SCHEMA = Schema(
        ("error_code", Int16),
        (
            "api_versions",
            Array(("api_key", Int16), ("min_version", Int16), ("max_version", Int16)),
        ),
        ("throttle_time_ms", Int32),
    )
예제 #2
0
class ApiVersionResponse_v1(Response):
    API_KEY = 18
    API_VERSION = 1
    SCHEMA = Schema(
        ('error_code', Int16),
        ('api_versions', Array(
            ('api_key', Int16),
            ('min_version', Int16),
            ('max_version', Int16))),
        ('throttle_time_ms', Int32)
    )
예제 #3
0
class ListGroupsResponse_v1(Response):
    API_KEY = 16
    API_VERSION = 1
    SCHEMA = Schema(
        ("throttle_time_ms", Int32),
        ("error_code", Int16),
        (
            "groups",
            Array(("group", String("utf-8")), ("protocol_type", String("utf-8"))),
        ),
    )
예제 #4
0
class JoinGroupRequest_v0(Request):
    API_KEY = 11
    API_VERSION = 0
    RESPONSE_TYPE = JoinGroupResponse_v0
    SCHEMA = Schema(('group', String('utf-8')), ('session_timeout', Int32),
                    ('member_id', String('utf-8')),
                    ('protocol_type', String('utf-8')),
                    ('group_protocols',
                     Array(('protocol_name', String('utf-8')),
                           ('protocol_metadata', Bytes))))
    UNKNOWN_MEMBER_ID = ''
예제 #5
0
class AlterConfigsRequest_v0(Request):
    API_KEY = 33
    API_VERSION = 0
    RESPONSE_TYPE = AlterConfigsResponse_v0
    SCHEMA = Schema(
        ('resources',
         Array(('resource_type', Int8), ('resource_name', String('utf-8')),
               ('config_entries',
                Array(('config_name', String('utf-8')),
                      ('config_value', String('utf-8')))))),
        ('validate_only', Boolean))
예제 #6
0
 class ListPartitionReassignmentsRequest_v0(Request):
     FLEXIBLE_VERSION = True
     API_KEY = 46
     API_VERSION = 0
     RESPONSE_TYPE = ListPartitionReassignmentsResponse_v0
     SCHEMA = Schema(("timeout_ms", Int32),
                     ("topics",
                      CompactArray(("name", CompactString("utf-8")),
                                   ("partition_index", CompactArray(Int32)),
                                   ("tags", TaggedFields))),
                     ("tags", TaggedFields))
예제 #7
0
class DescribeClientQuotasRequest_v0(Request):
    API_KEY = 48
    API_VERSION = 0
    RESPONSE_TYPE = DescribeClientQuotasResponse_v0
    SCHEMA = Schema(
        ('components', Array(
            ('entity_type', String('utf-8')),
            ('match_type', Int8),
            ('match', String('utf-8')),
        )),
        ('strict', Boolean)
    )
예제 #8
0
class DescribeAclsResponse_v0(Response):
    API_KEY = 29
    API_VERSION = 0
    SCHEMA = Schema(
        ('throttle_time_ms', Int32), ('error_code', Int16),
        ('error_message', String('utf-8')),
        ('resources',
         Array(('resource_type', Int8), ('resource_name', String('utf-8')),
               ('acls',
                Array(('principal', String('utf-8')),
                      ('host', String('utf-8')), ('operation', Int8),
                      ('permission_type', Int8))))))
예제 #9
0
class OffsetRequest_v2(Request):
    API_KEY = 2
    API_VERSION = 2
    RESPONSE_TYPE = OffsetResponse_v2
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('isolation_level', Int8),  # <- added isolation_level
        ('topics',
         Array(('topic', String('utf-8')),
               ('partitions', Array(('partition', Int32),
                                    ('timestamp', Int64))))))
    DEFAULTS = {'replica_id': -1}
예제 #10
0
class AlterConfigsResponse_v0(Response):
    """
    AlterConfigs version 0 from Kafka protocol
    Response serialization
    """
    API_KEY = 33
    API_VERSION = 0
    SCHEMA = Schema(
        ('throttle_time_ms', Int32),
        ('resources',
         Array(('error_code', Int16), ('error_message', String('utf-8')),
               ('resource_type', Int8), ('resource_name', String('utf-8')))))
class JoinGroupResponse_v0(Response):
    API_KEY = 11
    API_VERSION = 0
    SCHEMA = Schema(
        ("error_code", Int16),
        ("generation_id", Int32),
        ("group_protocol", String("utf-8")),
        ("leader_id", String("utf-8")),
        ("member_id", String("utf-8")),
        ("members",
         Array(("member_id", String("utf-8")), ("member_metadata", Bytes))),
    )
예제 #12
0
class OffsetCommitRequest_v0(Struct):
    API_KEY = API_KEY
    API_VERSION = 0
    SCHEMA = Schema(('group_id', String('utf-8')),
                    ('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions',
                            Array(
                                ('partition', Int32),
                                ('offset', Int64),
                                ('metadata', String('utf-8')),
                            )))))
예제 #13
0
class DescribeAclsRequest_v0(Request):
    API_KEY = 29
    API_VERSION = 0
    RESPONSE_TYPE = DescribeAclsResponse_v0
    SCHEMA = Schema(
        ("resource_type", Int8),
        ("resource_name", String("utf-8")),
        ("principal", String("utf-8")),
        ("host", String("utf-8")),
        ("operation", Int8),
        ("permission_type", Int8),
    )
예제 #14
0
class RequestHeader(Struct):
    SCHEMA = Schema(
        ("api_key", Int16),
        ("api_version", Int16),
        ("correlation_id", Int32),
        ("client_id", String("utf-8")),
    )

    def __init__(self, request, correlation_id=0, client_id="kafka-python"):
        super(RequestHeader,
              self).__init__(request.API_KEY, request.API_VERSION,
                             correlation_id, client_id)
예제 #15
0
class AlterClientQuotasRequest_v0(Request):
    API_KEY = 49
    API_VERSION = 0
    RESPONSE_TYPE = AlterClientQuotasResponse_v0
    SCHEMA = Schema(('entries',
                     Array(('entity',
                            Array(('entity_type', String('utf-8')),
                                  ('entity_name', String('utf-8')))),
                           ('ops',
                            Array(('key', String('utf-8')), ('value', Float64),
                                  ('remove', Boolean))))),
                    ('validate_only', Boolean))
예제 #16
0
class AlterClientQuotasResponse_v0(Response):
    API_KEY = 49
    API_VERSION = 0
    SCHEMA = Schema(
        ('throttle_time_ms', Int32),
        ('entries', Array(
            ('error_code', Int16),
            ('error_message', String('utf-8')),
            ('entity', Array(
                ('entity_type', String('utf-8')),
                ('entity_name', String('utf-8'))))))
    )
예제 #17
0
class ConsumerProtocolMemberAssignment(Struct):
    SCHEMA = Schema(('version', Int16), ('assignment',
                                         Array(('topic', String('utf-8')),
                                               ('partitions', Array(Int32)))),
                    ('user_data', Bytes))

    def partitions(self):
        return [
            TopicPartition(topic, partition) for topic, partitions in
            self.assignment  # pylint: disable-msg=no-member
            for partition in partitions
        ]
예제 #18
0
class OffsetFetchResponse_v0(Response):
    API_KEY = 9
    API_VERSION = 0
    SCHEMA = Schema(
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('offset', Int64),
                ('metadata', String('utf-8')),
                ('error_code', Int16)))))
    )
예제 #19
0
class AddPartitionsToTxnRequest_v0(Request):
    API_KEY = 24
    API_VERSION = 0
    RESPONSE_TYPE = AddPartitionsToTxnResponse_v0
    SCHEMA = Schema(
        ('transactional_id', String('utf-8')),
        ('producer_id', Int64),
        ('producer_epoch', Int16),
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(Int32))))
    )
예제 #20
0
class DescribeConfigsRequestV0(Request):
    """
    DescribeConfigs in Kafka Protocol
    Request serialization
    """
    API_KEY = 32
    API_VERSION = 0
    RESPONSE_TYPE = DescribeConfigsResponseV0
    SCHEMA = Schema(
        ('resources',
         Array(('resource_type', Int8), ('resource_name', String('utf-8')),
               ('config_names', Array(String('utf-8'))))))
예제 #21
0
class ProduceResponse_v1(Response):
    API_KEY = 0
    API_VERSION = 1
    SCHEMA = Schema(
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('error_code', Int16),
                ('offset', Int64))))),
        ('throttle_time_ms', Int32)
    )
예제 #22
0
class ProduceRequest_v0(ProduceRequest):
    API_VERSION = 0
    RESPONSE_TYPE = ProduceResponse_v0
    SCHEMA = Schema(
        ('required_acks', Int16),
        ('timeout', Int32),
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('messages', Bytes)))))
    )
예제 #23
0
class DescribeAclsRequest_v0(Request):
    API_KEY = 29
    API_VERSION = 0
    RESPONSE_TYPE = DescribeAclsResponse_v0
    SCHEMA = Schema(
        ('resource_type', Int8),
        ('resource_name', String('utf-8')),
        ('principal', String('utf-8')),
        ('host', String('utf-8')),
        ('operation', Int8),
        ('permission_type', Int8)
    )
예제 #24
0
파일: transaction.py 프로젝트: ods/aiokafka
class TxnOffsetCommitRequest_v0(Request):
    API_KEY = 28
    API_VERSION = 0
    RESPONSE_TYPE = TxnOffsetCommitResponse_v0
    SCHEMA = Schema(('transactional_id', String('utf-8')),
                    ('group_id', String('utf-8')), ('producer_id', Int64),
                    ('producer_epoch', Int16),
                    ('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions',
                            Array(('partition', Int32), ('offset', Int64),
                                  ('metadata', String('utf-8')))))))
예제 #25
0
class FetchResponse_v0(Response):
    API_KEY = 1
    API_VERSION = 0
    SCHEMA = Schema(
        ('topics', Array(
            ('topics', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('error_code', Int16),
                ('highwater_offset', Int64),
                ('message_set', Bytes)))))
    )
예제 #26
0
class OffsetCommitRequest_v0(Request):
    API_KEY = 8
    API_VERSION = 0  # Zookeeper-backed storage
    RESPONSE_TYPE = OffsetCommitResponse_v0
    SCHEMA = Schema(
        ('consumer_group', String('utf-8')),
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('offset', Int64),
                ('metadata', String('utf-8'))))))
    )
예제 #27
0
class LeaderAndIsrRequest_v1(Request):
    API_KEY = 4
    API_VERSION = 1
    RESPONSE_TYPE = LeaderAndIsrResponse_v1
    SCHEMA = Schema(
        ('controller_id', Int32), ('controller_epoch', Int32),
        ('partition_states',
         Array(('topic', String('utf-8')), ('partition', Int32),
               ('controller_epoch', Int32), ('leader', Int32),
               ('leader_epoch', Int32), ('isr', Int32), ('zk_version', Int32),
               ('replicas', Int32), ('is_new', Boolean))),
        ('live_leaders',
         Array(('id', Int32), ('host', String('utf-8')), ('port', Int32))))
예제 #28
0
class DescribeConfigsResponse_v0(Response):
    API_KEY = 32
    API_VERSION = 0
    SCHEMA = Schema(
        ('throttle_time_ms', Int32),
        ('resources',
         Array(('error_code', Int16), ('error_message', String('utf-8')),
               ('resource_type', Int8), ('resource_name', String('utf-8')),
               ('config_entries',
                Array(('config_name', String('utf-8')),
                      ('config_value', String('utf-8')),
                      ('read_only', Boolean), ('is_default', Boolean),
                      ('is_sensitive', Boolean))))))
예제 #29
0
class CreateAclsRequest_v0(Request):
    API_KEY = 30
    API_VERSION = 0
    RESPONSE_TYPE = CreateAclsResponse_v0
    SCHEMA = Schema(
        ('creations', Array(
            ('resource_type', Int8),
            ('resource_name', String('utf-8')),
            ('principal', String('utf-8')),
            ('host', String('utf-8')),
            ('operation', Int8),
            ('permission_type', Int8)))
    )
예제 #30
0
class FetchRequest_v5(Request):
    # This may only be used in broker-broker api calls
    API_KEY = 1
    API_VERSION = 5
    RESPONSE_TYPE = FetchResponse_v5
    SCHEMA = Schema(
        ('replica_id', Int32), ('max_wait_time', Int32), ('min_bytes', Int32),
        ('max_bytes', Int32), ('isolation_level', Int8),
        ('topics',
         Array(('topic', String('utf-8')),
               ('partitions',
                Array(('partition', Int32), ('fetch_offset', Int64),
                      ('log_start_offset', Int64), ('max_bytes', Int32))))))