kf-protocol-message 2.0.0

Rust kafka protocol message definition
Documentation
/// WARNING: CODE GENERATED FILE
/// * This file is generated by kfspec2code.
/// * Any changes applied to this file will be lost when a new spec is generated.
use serde::{Deserialize, Serialize};

use kf_protocol_api::ErrorCode;
use kf_protocol_api::Request;

use kf_protocol_derive::Decode;
use kf_protocol_derive::Encode;
use kf_protocol_derive::KfDefault;

// -----------------------------------
// KfStopReplicaRequest
// -----------------------------------

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct KfStopReplicaRequest {
    /// The controller id.
    pub controller_id: i32,

    /// The controller epoch.
    pub controller_epoch: i32,

    /// The broker epoch.
    #[fluvio_kf(min_version = 1, ignorable)]
    pub broker_epoch: i64,

    /// Whether these partitions should be deleted.
    pub delete_partitions: bool,

    /// The topics to stop.
    #[fluvio_kf(min_version = 1)]
    pub topics: Vec<StopReplicaRequestTopic>,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct StopReplicaRequestTopic {
    /// The topic name.
    #[fluvio_kf(min_version = 1)]
    pub name: String,

    /// The partition indexes.
    #[fluvio_kf(min_version = 1)]
    pub partition_indexes: Vec<i32>,
}

// -----------------------------------
// KfStopReplicaResponse
// -----------------------------------

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct KfStopReplicaResponse {
    /// The top-level error code, or 0 if there was no top-level error.
    pub error_code: ErrorCode,

    /// The responses for each partition.
    pub partitions: Vec<StopReplicaResponsePartition>,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct StopReplicaResponsePartition {
    /// The topic name.
    pub topic_name: String,

    /// The partition index.
    pub partition_index: i32,

    /// The partition error code, or 0 if there was no partition error.
    pub error_code: ErrorCode,
}

// -----------------------------------
// Implementation - KfStopReplicaRequest
// -----------------------------------

impl Request for KfStopReplicaRequest {
    const API_KEY: u16 = 5;

    const MIN_API_VERSION: i16 = 0;
    const MAX_API_VERSION: i16 = 1;
    const DEFAULT_API_VERSION: i16 = 1;

    type Response = KfStopReplicaResponse;
}