Skip to main content

ProducePartitionResponse

Struct ProducePartitionResponse 

Source
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: String

Topic name.

§partition: i32

Partition index.

§error_code: i16

Kafka error code (0 is success).

§base_offset: i64

First offset assigned to the batch, or Self::INVALID_OFFSET.

§log_append_time_ms: i64

Log append time, or RecordBatch::NO_TIMESTAMP.

§log_start_offset: i64

Log start offset, or Self::INVALID_OFFSET when omitted below v5.

§current_leader_id: i32

Produce v10+ CurrentLeader LeaderId, or MetadataResponse::NO_LEADER_ID when omitted (JSON default).

§current_leader_epoch: i32

Produce 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

Source

pub const INVALID_OFFSET: i64 = -1

Java ProduceResponse.INVALID_OFFSET.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ProducePartitionResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProducePartitionResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ProducePartitionResponse

Source§

impl PartialEq for ProducePartitionResponse

Source§

fn eq(&self, other: &ProducePartitionResponse) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProducePartitionResponse

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more