@@ -36,28 +36,21 @@ def checksum(self):
36
36
be the checksum for v0 and v1 and None for v2 and above.
37
37
"""
38
38
39
- @abc .abstractproperty
40
- def headers (self ):
41
- """ If supported by version list of key-value tuples, or empty list if
42
- not supported by format.
43
- """
44
-
45
39
46
40
class ABCRecordBatchBuilder (object ):
47
41
__metaclass__ = abc .ABCMeta
48
42
49
43
@abc .abstractmethod
50
- def append (self , offset , timestamp , key , value , headers ):
44
+ def append (self , offset , timestamp , key , value ):
51
45
""" Writes record to internal buffer.
52
46
53
47
Arguments:
54
48
offset (int): Relative offset of record, starting from 0
55
- timestamp (int): Timestamp in milliseconds since beginning of the
56
- epoch (midnight Jan 1, 1970 (UTC))
49
+ timestamp (int or None): Timestamp in milliseconds since beginning
50
+ of the epoch (midnight Jan 1, 1970 (UTC)). If omited, will be
51
+ set to current time.
57
52
key (bytes or None): Key of the record
58
53
value (bytes or None): Value of the record
59
- headers (List[Tuple[str, bytes]]): Headers of the record. Header
60
- keys can not be ``None``.
61
54
62
55
Returns:
63
56
(bytes, int): Checksum of the written record (or None for v2 and
@@ -74,10 +67,10 @@ def size_in_bytes(self, offset, timestamp, key, value, headers):
74
67
@abc .abstractmethod
75
68
def build (self ):
76
69
""" Close for append, compress if needed, write size and header and
77
- return a ready to send bytes object.
70
+ return a ready to send buffer object.
78
71
79
72
Return:
80
- io.BytesIO : finished batch, ready to send.
73
+ bytearray : finished batch, ready to send.
81
74
"""
82
75
83
76
@@ -105,7 +98,7 @@ def __init__(self, buffer):
105
98
106
99
@abc .abstractmethod
107
100
def size_in_bytes (self ):
108
- """ Returns the size of buffer.
101
+ """ Returns the size of inner buffer.
109
102
"""
110
103
111
104
@abc .abstractmethod
0 commit comments