summaryrefslogtreecommitdiff
path: root/kafka/record/legacy_records.py
diff options
context:
space:
mode:
Diffstat (limited to 'kafka/record/legacy_records.py')
-rw-r--r--kafka/record/legacy_records.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/kafka/record/legacy_records.py b/kafka/record/legacy_records.py
index bb6c21c..e2ee549 100644
--- a/kafka/record/legacy_records.py
+++ b/kafka/record/legacy_records.py
@@ -57,6 +57,8 @@ from kafka.errors import CorruptRecordException, UnsupportedCodecError
class LegacyRecordBase(object):
+ __slots__ = ()
+
HEADER_STRUCT_V0 = struct.Struct(
">q" # BaseOffset => Int64
"i" # Length => Int32
@@ -127,6 +129,9 @@ class LegacyRecordBase(object):
class LegacyRecordBatch(ABCRecordBatch, LegacyRecordBase):
+ __slots__ = ("_buffer", "_magic", "_offset", "_crc", "_timestamp",
+ "_attributes", "_decompressed")
+
def __init__(self, buffer, magic):
self._buffer = memoryview(buffer)
self._magic = magic
@@ -336,6 +341,8 @@ class LegacyRecord(ABCRecord):
class LegacyRecordBatchBuilder(ABCRecordBatchBuilder, LegacyRecordBase):
+ __slots__ = ("_magic", "_compression_type", "_batch_size", "_buffer")
+
def __init__(self, magic, compression_type, batch_size):
self._magic = magic
self._compression_type = compression_type