API refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-07 16:25:52 +09:00
parent 76d0d86211
commit 91c7e04474
1171 changed files with 81940 additions and 44117 deletions

View File

@@ -1,9 +1,15 @@
from __future__ import absolute_import
import collections
from kafka.protocol.api import Request, Response
from kafka.protocol.types import Array, Int8, Int16, Int32, Int64, Schema, String, Bytes
AbortedTransaction = collections.namedtuple("AbortedTransaction",
["producer_id", "first_offset"])
class FetchResponse_v0(Response):
API_KEY = 1
API_VERSION = 0
@@ -14,7 +20,7 @@ class FetchResponse_v0(Response):
('partition', Int32),
('error_code', Int16),
('highwater_offset', Int64),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -29,7 +35,7 @@ class FetchResponse_v1(Response):
('partition', Int32),
('error_code', Int16),
('highwater_offset', Int64),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -46,6 +52,7 @@ class FetchResponse_v3(Response):
class FetchResponse_v4(Response):
# Adds message format v2
API_KEY = 1
API_VERSION = 4
SCHEMA = Schema(
@@ -60,7 +67,7 @@ class FetchResponse_v4(Response):
('aborted_transactions', Array(
('producer_id', Int64),
('first_offset', Int64))),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -80,7 +87,7 @@ class FetchResponse_v5(Response):
('aborted_transactions', Array(
('producer_id', Int64),
('first_offset', Int64))),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -115,7 +122,7 @@ class FetchResponse_v7(Response):
('aborted_transactions', Array(
('producer_id', Int64),
('first_offset', Int64))),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -156,7 +163,7 @@ class FetchResponse_v11(Response):
('producer_id', Int64),
('first_offset', Int64))),
('preferred_read_replica', Int32),
('message_set', Bytes)))))
('records', Bytes)))))
)
@@ -211,6 +218,7 @@ class FetchRequest_v3(Request):
class FetchRequest_v4(Request):
# Adds isolation_level field
# Adds message format v2
API_KEY = 1
API_VERSION = 4
RESPONSE_TYPE = FetchResponse_v4
@@ -264,7 +272,7 @@ class FetchRequest_v6(Request):
class FetchRequest_v7(Request):
"""
Add incremental fetch requests
Add incremental fetch requests (see KIP-227)
"""
API_KEY = 1
API_VERSION = 7
@@ -285,7 +293,7 @@ class FetchRequest_v7(Request):
('log_start_offset', Int64),
('max_bytes', Int32))))),
('forgotten_topics_data', Array(
('topic', String),
('topic', String('utf-8')),
('partitions', Array(Int32))
)),
)
@@ -325,7 +333,7 @@ class FetchRequest_v9(Request):
('log_start_offset', Int64),
('max_bytes', Int32))))),
('forgotten_topics_data', Array(
('topic', String),
('topic', String('utf-8')),
('partitions', Array(Int32)),
)),
)
@@ -365,7 +373,7 @@ class FetchRequest_v11(Request):
('log_start_offset', Int64),
('max_bytes', Int32))))),
('forgotten_topics_data', Array(
('topic', String),
('topic', String('utf-8')),
('partitions', Array(Int32))
)),
('rack_id', String('utf-8')),