diff options
Diffstat (limited to 'kafka/protocol/metadata.py')
-rw-r--r-- | kafka/protocol/metadata.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kafka/protocol/metadata.py b/kafka/protocol/metadata.py new file mode 100644 index 0000000..b35e7ef --- /dev/null +++ b/kafka/protocol/metadata.py @@ -0,0 +1,28 @@ +from .struct import Struct +from .types import Array, Int16, Int32, Schema, String + + +class MetadataRequest(Struct): + API_KEY = 3 + API_VERSION = 0 + SCHEMA = Schema( + ('topics', Array(String('utf-8'))) + ) + + +class MetadataResponse(Struct): + SCHEMA = Schema( + ('brokers', Array( + ('node_id', Int32), + ('host', String('utf-8')), + ('port', Int32))), + ('topics', Array( + ('error_code', Int16), + ('topic', String('utf-8')), + ('partitions', Array( + ('error_code', Int16), + ('partition', Int32), + ('leader', Int32), + ('replicas', Array(Int32)), + ('isr', Array(Int32)))))) + ) |