diff options
author | Dana Powers <dana.powers@rd.io> | 2015-11-28 19:41:06 +0800 |
---|---|---|
committer | Zack Dever <zack.dever@rd.io> | 2015-12-04 11:25:39 -0800 |
commit | a85e09df89a43de5b659a0fa4ed35bec37c60e04 (patch) | |
tree | a539af32fe502006c1f35b96d8ae36225292f7a5 /kafka/protocol/fetch.py | |
parent | e24a4d5f5252d6f97ac586e328b95779ef83f4b6 (diff) | |
download | kafka-python-a85e09df89a43de5b659a0fa4ed35bec37c60e04.tar.gz |
Rework protocol type definition: AbstractType, Schema, Struct
Diffstat (limited to 'kafka/protocol/fetch.py')
-rw-r--r-- | kafka/protocol/fetch.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kafka/protocol/fetch.py b/kafka/protocol/fetch.py new file mode 100644 index 0000000..c6d60cc --- /dev/null +++ b/kafka/protocol/fetch.py @@ -0,0 +1,30 @@ +from .message import MessageSet +from .struct import Struct +from .types import Array, Int16, Int32, Int64, Schema, String + + +class FetchRequest(Struct): + API_KEY = 1 + API_VERSION = 0 + SCHEMA = Schema( + ('replica_id', Int32), + ('max_wait_time', Int32), + ('min_bytes', Int32), + ('topics', Array( + ('topic', String('utf-8')), + ('partitions', Array( + ('partition', Int32), + ('offset', Int64), + ('max_bytes', Int32))))) + ) + +class FetchResponse(Struct): + SCHEMA = Schema( + ('topics', Array( + ('topics', String('utf-8')), + ('partitions', Array( + ('partition', Int32), + ('error_code', Int16), + ('highwater_offset', Int64), + ('message_set', MessageSet))))) + ) |