summaryrefslogtreecommitdiff
path: root/kafka/protocol/offset.py
blob: 776de39bb0456de33d6e981728876dbd0761e60a (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
31
from .struct import Struct
from .types import Array, Int16, Int32, Int64, Schema, String


class OffsetResponse(Struct):
    SCHEMA = Schema(
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('error_code', Int16),
                ('offsets', Array(Int64))))))
    )


class OffsetRequest(Struct):
    API_KEY = 2
    API_VERSION = 0
    RESPONSE_TYPE = OffsetResponse
    SCHEMA = Schema(
        ('replica_id', Int32),
        ('topics', Array(
            ('topic', String('utf-8')),
            ('partitions', Array(
                ('partition', Int32),
                ('time', Int64),
                ('max_offsets', Int32)))))
    )
    DEFAULTS = {
        'replica_id': -1
    }