From 90c729438a2e3f1b194e58231e41bd16bd7b7172 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Tue, 5 Apr 2016 22:54:28 -0700 Subject: Use version-indexed lists for request/response protocol structs --- kafka/protocol/fetch.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'kafka/protocol/fetch.py') diff --git a/kafka/protocol/fetch.py b/kafka/protocol/fetch.py index e00c9ab..eeda4e7 100644 --- a/kafka/protocol/fetch.py +++ b/kafka/protocol/fetch.py @@ -3,7 +3,9 @@ from .struct import Struct from .types import Array, Int16, Int32, Int64, Schema, String -class FetchResponse(Struct): +class FetchResponse_v0(Struct): + API_KEY = 1 + API_VERSION = 0 SCHEMA = Schema( ('topics', Array( ('topics', String('utf-8')), @@ -15,10 +17,10 @@ class FetchResponse(Struct): ) -class FetchRequest(Struct): +class FetchRequest_v0(Struct): API_KEY = 1 API_VERSION = 0 - RESPONSE_TYPE = FetchResponse + RESPONSE_TYPE = FetchResponse_v0 SCHEMA = Schema( ('replica_id', Int32), ('max_wait_time', Int32), @@ -30,3 +32,7 @@ class FetchRequest(Struct): ('offset', Int64), ('max_bytes', Int32))))) ) + + +FetchRequest = [FetchRequest_v0] +FetchResponse = [FetchResponse_v0] -- cgit v1.2.1