Esempio n. 1
0
class MetadataResponse_v2(Response):
    API_KEY = 3
    API_VERSION = 2
    SCHEMA = Schema(
        (
            "brokers",
            Array(
                ("node_id", Int32),
                ("host", String("utf-8")),
                ("port", Int32),
                ("rack", String("utf-8")),
            ),
        ),
        ("cluster_id", String("utf-8")),  # <-- Added cluster_id field in v2
        ("controller_id", Int32),
        (
            "topics",
            Array(
                ("error_code", Int16),
                ("topic", String("utf-8")),
                ("is_internal", Boolean),
                (
                    "partitions",
                    Array(
                        ("error_code", Int16),
                        ("partition", Int32),
                        ("leader", Int32),
                        ("replicas", Array(Int32)),
                        ("isr", Array(Int32)),
                    ),
                ),
            ),
        ),
    )
class OffsetCommitRequest_v2(Request):
    API_KEY = 8
    API_VERSION = 2  # added retention_time, dropped timestamp
    RESPONSE_TYPE = OffsetCommitResponse_v2
    SCHEMA = Schema(
        ("consumer_group", String("utf-8")),
        ("consumer_group_generation_id", Int32),
        ("consumer_id", String("utf-8")),
        ("retention_time", Int64),
        (
            "topics",
            Array(
                ("topic", String("utf-8")),
                (
                    "partitions",
                    Array(
                        ("partition", Int32),
                        ("offset", Int64),
                        ("metadata", String("utf-8")),
                    ),
                ),
            ),
        ),
    )
    DEFAULT_GENERATION_ID = -1
    DEFAULT_RETENTION_TIME = -1
Esempio n. 3
0
class DescribeConfigsResponse_v2(Response):
    API_KEY = 32
    API_VERSION = 2
    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_names", String("utf-8")),
                        ("config_value", String("utf-8")),
                        ("read_only", Boolean),
                        ("config_source", Int8),
                        ("is_sensitive", Boolean),
                        (
                            "config_synonyms",
                            Array(
                                ("config_name", String("utf-8")),
                                ("config_value", String("utf-8")),
                                ("config_source", Int8),
                            ),
                        ),
                    ),
                ),
            ),
        ),
    )
Esempio n. 4
0
class MetadataResponse_v0(Response):
    API_KEY = 3
    API_VERSION = 0
    SCHEMA = Schema(
        (
            "brokers",
            Array(("node_id", Int32), ("host", String("utf-8")),
                  ("port", Int32)),
        ),
        (
            "topics",
            Array(
                ("error_code", Int16),
                ("topic", String("utf-8")),
                (
                    "partitions",
                    Array(
                        ("error_code", Int16),
                        ("partition", Int32),
                        ("leader", Int32),
                        ("replicas", Array(Int32)),
                        ("isr", Array(Int32)),
                    ),
                ),
            ),
        ),
    )
Esempio n. 5
0
class DescribeGroupsResponse_v3(Response):
    API_KEY = 15
    API_VERSION = 3
    SCHEMA = Schema(
        ("throttle_time_ms", Int32),
        (
            "groups",
            Array(
                ("error_code", Int16),
                ("group", String("utf-8")),
                ("state", String("utf-8")),
                ("protocol_type", String("utf-8")),
                ("protocol", String("utf-8")),
                (
                    "members",
                    Array(
                        ("member_id", String("utf-8")),
                        ("client_id", String("utf-8")),
                        ("client_host", String("utf-8")),
                        ("member_metadata", Bytes),
                        ("member_assignment", Bytes),
                    ),
                ),
            ),
            ("authorized_operations", Int32),
        ),
    )
Esempio n. 6
0
class DeleteAclsResponse_v1(Response):
    API_KEY = 31
    API_VERSION = 1
    SCHEMA = Schema(
        ("throttle_time_ms", Int32),
        (
            "filter_responses",
            Array(
                ("error_code", Int16),
                ("error_message", String("utf-8")),
                (
                    "matching_acls",
                    Array(
                        ("error_code", Int16),
                        ("error_message", String("utf-8")),
                        ("resource_type", Int8),
                        ("resource_name", String("utf-8")),
                        ("resource_pattern_type", Int8),
                        ("principal", String("utf-8")),
                        ("host", String("utf-8")),
                        ("operation", Int8),
                        ("permission_type", Int8),
                    ),
                ),
            ),
        ),
    )
Esempio n. 7
0
class DescribeGroupsResponse_v0(Response):
    API_KEY = 15
    API_VERSION = 0
    SCHEMA = Schema(
        (
            "groups",
            Array(
                ("error_code", Int16),
                ("group", String("utf-8")),
                ("state", String("utf-8")),
                ("protocol_type", String("utf-8")),
                ("protocol", String("utf-8")),
                (
                    "members",
                    Array(
                        ("member_id", String("utf-8")),
                        ("client_id", String("utf-8")),
                        ("client_host", String("utf-8")),
                        ("member_metadata", Bytes),
                        ("member_assignment", Bytes),
                    ),
                ),
            ),
        )
    )
Esempio n. 8
0
class CreateTopicsRequest_v1(Request):
    API_KEY = 19
    API_VERSION = 1
    RESPONSE_TYPE = CreateTopicsResponse_v1
    SCHEMA = Schema(
        (
            "create_topic_requests",
            Array(
                ("topic", String("utf-8")),
                ("num_partitions", Int32),
                ("replication_factor", Int16),
                (
                    "replica_assignment",
                    Array(("partition_id", Int32), ("replicas", Array(Int32))),
                ),
                (
                    "configs",
                    Array(
                        ("config_key", String("utf-8")),
                        ("config_value", String("utf-8")),
                    ),
                ),
            ),
        ),
        ("timeout", Int32),
        ("validate_only", Boolean),
    )
Esempio n. 9
0
class UpdateMetadataRequest_v2(Struct):
    API_KEY = API_KEY
    API_VERSION = 2
    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),
                         ('isrs', Array(Int32)),
                         ('zk_version', Int32),
                         ('replicas', Array(Int32)),
                     )), ('live_leaders',
                          Array(
                              ('id', Int32),
                              ('end_points',
                               Array(
                                   ('port', Int32),
                                   ('host', String('utf-8')),
                                   ('security_protocol_type', Int16),
                               )),
                              ('rack', String('utf-8')),
                          )))
Esempio n. 10
0
class FetchRequest_v9(Request):
    """
    adds the current leader epoch (see KIP-320)
    """
    API_KEY = 1
    API_VERSION = 9
    RESPONSE_TYPE = FetchResponse_v9
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('max_wait_time', Int32),
        ('min_bytes', Int32),
        ('max_bytes', Int32),
        ('isolation_level', Int8),
        ('session_id', Int32),
        ('session_epoch', Int32),
        ('topics',
         Array(('topic', String('utf-8')),
               ('partitions',
                Array(('partition', Int32), ('current_leader_epoch', Int32),
                      ('fetch_offset', Int64), ('log_start_offset', Int64),
                      ('max_bytes', Int32))))),
        ('forgotten_topics_data',
         Array(
             ('topic', String),
             ('partitions', Array(Int32)),
         )),
    )
Esempio n. 11
0
class OffsetFetchRequest_v0(Struct):
    API_KEY = API_KEY
    API_VERSION = 0
    SCHEMA = Schema(('group_id', String('utf-8')),
                    ('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions', Array(Int32)))))
Esempio n. 12
0
class FetchRequest_v11(Request):
    """
    added rack ID to support read from followers (KIP-392)
    """
    API_KEY = 1
    API_VERSION = 11
    RESPONSE_TYPE = FetchResponse_v11
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('max_wait_time', Int32),
        ('min_bytes', Int32),
        ('max_bytes', Int32),
        ('isolation_level', Int8),
        ('session_id', Int32),
        ('session_epoch', Int32),
        ('topics',
         Array(('topic', String('utf-8')),
               ('partitions',
                Array(('partition', Int32), ('current_leader_epoch', Int32),
                      ('fetch_offset', Int64), ('log_start_offset', Int64),
                      ('max_bytes', Int32))))),
        ('forgotten_topics_data',
         Array(('topic', String), ('partitions', Array(Int32)))),
        ('rack_id', String('utf-8')),
    )
class FetchResponse_v5(Response):
    API_KEY = 1
    API_VERSION = 5
    SCHEMA = Schema(
        ("throttle_time_ms", Int32),
        (
            "topics",
            Array(
                ("topics", String("utf-8")),
                (
                    "partitions",
                    Array(
                        ("partition", Int32),
                        ("error_code", Int16),
                        ("highwater_offset", Int64),
                        ("last_stable_offset", Int64),
                        ("log_start_offset", Int64),
                        (
                            "aborted_transactions",
                            Array(("producer_id", Int64),
                                  ("first_offset", Int64)),
                        ),
                        ("message_set", Bytes),
                    ),
                ),
            ),
        ),
    )
class MemberAssignment(Struct):
    SCHEMA = Schema(
        ("version", Int16),
        ("assignment",
         Array(("topic", String("utf-8")), ("partitions", Array(Int32)))),
        ("user_data", Bytes),
    )
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),
                    ),
                ),
            ),
        ),
    )
Esempio n. 16
0
class OffsetResponse_v1(Response):
    API_KEY = 2
    API_VERSION = 1
    SCHEMA = Schema(('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions',
                            Array(('partition', Int32), ('error_code', Int16),
                                  ('timestamp', Int64), ('offset', Int64))))))
Esempio n. 17
0
class OffsetRequest_v1(Struct):
    API_KEY = API_KEY
    API_VERSION = 1
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('topics',
         Array(('topic', String('utf-8')),
               ('partitions', Array(('partition', Int32), ('time', Int64))))))
Esempio n. 18
0
class OffsetDeleteRequest_v0(Request):
    API_KEY = 47
    API_VERSION = 0
    RESPONSE_TYPE = OffsetDeleteResponse_v0
    SCHEMA = Schema(('group_id', String('utf-8')),
                    ('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions', Array(Int32)))))
Esempio n. 19
0
class ProduceResponse_v0(Response):
    API_KEY = 0
    API_VERSION = 0
    SCHEMA = Schema(('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions',
                            Array(('partition', Int32), ('error_code', Int16),
                                  ('offset', Int64))))))
Esempio n. 20
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)))))
class OffsetFetchRequest_v0(Request):
    API_KEY = 9
    API_VERSION = 0  # zookeeper-backed storage
    RESPONSE_TYPE = OffsetFetchResponse_v0
    SCHEMA = Schema(
        ("consumer_group", String("utf-8")),
        ("topics",
         Array(("topic", String("utf-8")), ("partitions", Array(Int32)))),
    )
Esempio n. 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))))))
Esempio n. 23
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))))))
Esempio n. 24
0
class ProduceResponse_v2(Response):
    API_KEY = 0
    API_VERSION = 2
    SCHEMA = Schema(('topics',
                     Array(('topic', String('utf-8')),
                           ('partitions',
                            Array(('partition', Int32), ('error_code', Int16),
                                  ('offset', Int64), ('timestamp', Int64))))),
                    ('throttle_time_ms', Int32))