summaryrefslogtreecommitdiff
path: root/kafka/protocol/fetch.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-04-05 13:04:24 -0700
committerDana Powers <dana.powers@gmail.com>2016-04-06 14:48:13 -0700
commit3d16f2ff5f75380c8a9fce846f35e92bb5bfb935 (patch)
tree169a0e740992d6bff7b4e46dbf047d14429b5d82 /kafka/protocol/fetch.py
parent331442ee0fcc0d888c2b2d2ed4f2a339d167b4a2 (diff)
downloadkafka-python-kafka-2136.tar.gz
KAFKA-2136: support Fetch and Produce v1 (throttle_time_ms)kafka-2136
Diffstat (limited to 'kafka/protocol/fetch.py')
-rw-r--r--kafka/protocol/fetch.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/kafka/protocol/fetch.py b/kafka/protocol/fetch.py
index eeda4e7..6aba972 100644
--- a/kafka/protocol/fetch.py
+++ b/kafka/protocol/fetch.py
@@ -17,6 +17,21 @@ class FetchResponse_v0(Struct):
)
+class FetchResponse_v1(Struct):
+ API_KEY = 1
+ API_VERSION = 1
+ SCHEMA = Schema(
+ ('throttle_time_ms', Int32),
+ ('topics', Array(
+ ('topics', String('utf-8')),
+ ('partitions', Array(
+ ('partition', Int32),
+ ('error_code', Int16),
+ ('highwater_offset', Int64),
+ ('message_set', MessageSet)))))
+ )
+
+
class FetchRequest_v0(Struct):
API_KEY = 1
API_VERSION = 0
@@ -34,5 +49,12 @@ class FetchRequest_v0(Struct):
)
-FetchRequest = [FetchRequest_v0]
-FetchResponse = [FetchResponse_v0]
+class FetchRequest_v1(Struct):
+ API_KEY = 1
+ API_VERSION = 1
+ RESPONSE_TYPE = FetchResponse_v1
+ SCHEMA = FetchRequest_v0.SCHEMA
+
+
+FetchRequest = [FetchRequest_v0, FetchRequest_v1]
+FetchResponse = [FetchResponse_v0, FetchResponse_v1]