summaryrefslogtreecommitdiff
path: root/kafka/protocol/fetch.py
blob: c6d60cc3d76ec827c32ce66d2803d436a03e8ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from .message import MessageSet
from .struct import Struct
from .types import Array, Int16, Int32, Int64, Schema, String


class FetchRequest(Struct):
    API_KEY = 1
    API_VERSION = 0
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('max_wait_time', Int32),
        ('min_bytes', Int32),
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('offset', Int64),
                ('max_bytes', Int32)))))
    )

class FetchResponse(Struct):
    SCHEMA = Schema(
        ('topics', Array(
            ('topics', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('error_code', Int16),
                ('highwater_offset', Int64),
                ('message_set', MessageSet)))))
    )