pub struct ProducePartitionResponse {
pub topic: String,
pub partition: i32,
pub error_code: i16,
pub base_offset: i64,
pub log_append_time_ms: i64,
pub log_start_offset: i64,
pub current_leader_id: i32,
pub current_leader_epoch: i32,
pub record_errors: Vec<ProduceRecordError>,
pub error_message: Option<String>,
}Expand description
One partition in a Produce response.
Self::INVALID_OFFSET is Java ProduceResponse.INVALID_OFFSET.
Self::partition_response is Java ProduceResponse.PartitionResponse(Errors)
(baseOffset / logStartOffset Self::INVALID_OFFSET, logAppendTime
RecordBatch::NO_TIMESTAMP, empty recordErrors, null errorMessage).
Self::partition_response_with_offsets is Java
ProduceResponse.PartitionResponse(Errors, long, long, long) (empty
recordErrors, null errorMessage; Java lastOffset stays
Self::INVALID_OFFSET and is not stored).
Self::partition_response_with_message is Java
ProduceResponse.PartitionResponse(Errors, String) (same sentinels as
Self::partition_response; empty recordErrors; Java lastOffset
stays Self::INVALID_OFFSET and is not stored).
Self::partition_response_with_record_errors is Java
ProduceResponse.PartitionResponse(Errors, long, long, long, List)
(recordErrors from the argument; null errorMessage; Java lastOffset
stays Self::INVALID_OFFSET and is not stored).
Self::partition_response_with_record_errors_and_message is Java
ProduceResponse.PartitionResponse(Errors, long, long, long, List, String)
(recordErrors and errorMessage from the arguments; Java lastOffset
stays Self::INVALID_OFFSET and is not stored).
Self::partition_response_with_current_leader is Java
ProduceResponse.PartitionResponse(Errors, long, long, long, List, String, LeaderIdAndEpoch)
(recordErrors / errorMessage / CurrentLeader from the arguments; Java
lastOffset stays Self::INVALID_OFFSET and is not stored). Decode below v2 fills
RecordBatch::NO_TIMESTAMP; decode below v5 fills
Self::INVALID_OFFSET. Decode below v8 fills empty recordErrors and
null errorMessage. Omitted v10+ CurrentLeader fills
MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH (JSON defaults).
Fields§
§topic: StringTopic name.
partition: i32Partition index.
error_code: i16Kafka error code (0 is success).
base_offset: i64First offset assigned to the batch, or Self::INVALID_OFFSET.
log_append_time_ms: i64Log append time, or RecordBatch::NO_TIMESTAMP.
log_start_offset: i64Log start offset, or Self::INVALID_OFFSET when omitted below v5.
current_leader_id: i32Produce v10+ CurrentLeader LeaderId, or
MetadataResponse::NO_LEADER_ID when omitted (JSON default).
current_leader_epoch: i32Produce v10+ CurrentLeader LeaderEpoch, or
RecordBatch::NO_PARTITION_LEADER_EPOCH when omitted (JSON default).
record_errors: Vec<ProduceRecordError>Produce v8+ RecordErrors (Java PartitionResponse.recordErrors).
Empty below v8 and when the broker sends none. Duplicates are kept.
error_message: Option<String>Produce v8+ ErrorMessage (Java PartitionResponse.errorMessage).
None is Java null (JSON default; omitted below v8).
Implementations§
Source§impl ProducePartitionResponse
impl ProducePartitionResponse
Sourcepub const INVALID_OFFSET: i64 = -1
pub const INVALID_OFFSET: i64 = -1
Java ProduceResponse.INVALID_OFFSET.
Sourcepub fn partition_response(
topic: impl Into<String>,
partition: i32,
error_code: i16,
) -> Self
pub fn partition_response( topic: impl Into<String>, partition: i32, error_code: i16, ) -> Self
Java ProduceResponse.PartitionResponse(Errors).
Java calls Self::partition_response_with_offsets with
Self::INVALID_OFFSET / RecordBatch::NO_TIMESTAMP /
Self::INVALID_OFFSET. CurrentLeader is the Apache JSON default
(MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH). recordErrors is empty
and errorMessage is null. Java PartitionResponse has no topic
name; this type does, so callers pass it.
Sourcepub fn partition_response_with_offsets(
topic: impl Into<String>,
partition: i32,
error_code: i16,
base_offset: i64,
log_append_time_ms: i64,
log_start_offset: i64,
) -> Self
pub fn partition_response_with_offsets( topic: impl Into<String>, partition: i32, error_code: i16, base_offset: i64, log_append_time_ms: i64, log_start_offset: i64, ) -> Self
Java ProduceResponse.PartitionResponse(Errors, long, long, long).
Sets baseOffset / logAppendTime / logStartOffset from the
arguments. Java lastOffset stays Self::INVALID_OFFSET and is
not a ProduceResponse field. recordErrors is empty and
errorMessage is null. CurrentLeader is the Apache JSON default
(MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH). Encode below v5 omits
logStartOffset; decode fills Self::INVALID_OFFSET. Encode
still writes independently. This crate speaks 3–12. This is not
Self::partition_response / ProduceResponse::to_data /
ProduceRequest::error_response.
Sourcepub fn partition_response_with_message(
topic: impl Into<String>,
partition: i32,
error_code: i16,
error_message: Option<String>,
) -> Self
pub fn partition_response_with_message( topic: impl Into<String>, partition: i32, error_code: i16, error_message: Option<String>, ) -> Self
Java ProduceResponse.PartitionResponse(Errors, String).
Same baseOffset / logAppendTime / logStartOffset sentinels as
Self::partition_response. Java lastOffset stays
Self::INVALID_OFFSET and is not a ProduceResponse field.
recordErrors is empty. errorMessage is the argument (None is
Java null). CurrentLeader is the Apache JSON default
(MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH). Encode below v8 omits
errorMessage; decode fills None. Encode still writes
independently. This crate speaks 3–12. This is not
Self::partition_response /
Self::partition_response_with_offsets /
ProduceResponse::to_data / ProduceRequest::error_response.
Sourcepub fn partition_response_with_record_errors(
topic: impl Into<String>,
partition: i32,
error_code: i16,
base_offset: i64,
log_append_time_ms: i64,
log_start_offset: i64,
record_errors: Vec<ProduceRecordError>,
) -> Self
pub fn partition_response_with_record_errors( topic: impl Into<String>, partition: i32, error_code: i16, base_offset: i64, log_append_time_ms: i64, log_start_offset: i64, record_errors: Vec<ProduceRecordError>, ) -> Self
Java ProduceResponse.PartitionResponse(Errors, long, long, long, List).
Sets baseOffset / logAppendTime / logStartOffset /
recordErrors from the arguments. Java lastOffset stays
Self::INVALID_OFFSET and is not a ProduceResponse field.
errorMessage is null. Duplicate batchIndex values are kept
(ArrayList). CurrentLeader is the Apache JSON default
(MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH). Encode below v8 omits
recordErrors; decode fills empty. Encode still writes
independently. This crate speaks 3–12. This is not
Self::partition_response /
Self::partition_response_with_offsets /
Self::partition_response_with_message /
ProduceResponse::to_data / ProduceRequest::error_response.
Sourcepub fn partition_response_with_record_errors_and_message(
topic: impl Into<String>,
partition: i32,
error_code: i16,
base_offset: i64,
log_append_time_ms: i64,
log_start_offset: i64,
record_errors: Vec<ProduceRecordError>,
error_message: Option<String>,
) -> Self
pub fn partition_response_with_record_errors_and_message( topic: impl Into<String>, partition: i32, error_code: i16, base_offset: i64, log_append_time_ms: i64, log_start_offset: i64, record_errors: Vec<ProduceRecordError>, error_message: Option<String>, ) -> Self
Java ProduceResponse.PartitionResponse(Errors, long, long, long, List, String).
Sets baseOffset / logAppendTime / logStartOffset /
recordErrors / errorMessage from the arguments. Java
lastOffset stays Self::INVALID_OFFSET and is not a
ProduceResponse field. None errorMessage is Java null.
Duplicate batchIndex values are kept (ArrayList). CurrentLeader
is the Apache JSON default (MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH). Encode below v8 omits
recordErrors and errorMessage; decode fills empty / None.
Encode still writes independently. This crate speaks 3–12. This is
not Self::partition_response /
Self::partition_response_with_offsets /
Self::partition_response_with_message /
Self::partition_response_with_record_errors /
ProduceResponse::to_data / ProduceRequest::error_response.
Sourcepub fn partition_response_with_current_leader(
topic: impl Into<String>,
partition: i32,
error_code: i16,
base_offset: i64,
log_append_time_ms: i64,
log_start_offset: i64,
record_errors: Vec<ProduceRecordError>,
error_message: Option<String>,
current_leader_id: i32,
current_leader_epoch: i32,
) -> Self
pub fn partition_response_with_current_leader( topic: impl Into<String>, partition: i32, error_code: i16, base_offset: i64, log_append_time_ms: i64, log_start_offset: i64, record_errors: Vec<ProduceRecordError>, error_message: Option<String>, current_leader_id: i32, current_leader_epoch: i32, ) -> Self
Java ProduceResponse.PartitionResponse(Errors, long, long, long, List, String, LeaderIdAndEpoch).
Sets baseOffset / logAppendTime / logStartOffset /
recordErrors / errorMessage / CurrentLeader from the arguments.
Java lastOffset stays Self::INVALID_OFFSET and is not a
ProduceResponse field (the Java constructor takes lastOffset;
this helper does not). None errorMessage is Java null.
Duplicate batchIndex values are kept (ArrayList). Encode below
v10 omits CurrentLeader; decode fills
MetadataResponse::NO_LEADER_ID /
RecordBatch::NO_PARTITION_LEADER_EPOCH. Encode still writes
independently (current_leader_id below 0 omits the tag even on
v10+). This crate speaks 3–12. This is not
Self::partition_response /
Self::partition_response_with_offsets /
Self::partition_response_with_message /
Self::partition_response_with_record_errors /
Self::partition_response_with_record_errors_and_message /
ProduceResponse::to_data / ProduceRequest::error_response.
Trait Implementations§
Source§impl Clone for ProducePartitionResponse
impl Clone for ProducePartitionResponse
Source§fn clone(&self) -> ProducePartitionResponse
fn clone(&self) -> ProducePartitionResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more