pub fn partition_metadata_to_replica_response(
    partitions: &PartitionLocalStore,
    topic: &String,
) -> Vec<FlvPartitionReplica> {
    let mut res: Vec<FlvPartitionReplica> = Vec::default();
    let partition_cnt = partitions.count_topic_partitions(topic);
    for idx in 0..partition_cnt {
        let name = ReplicaKey::new(topic.clone(), idx);
        if let Some(partition) = partitions.value(&name) {
            res.push(FlvPartitionReplica {
                id: idx,
                leader: partition.spec.leader,
                replicas: partition.spec.replicas.clone(),
                live_replicas: partition.status.live_replicas().clone(),
            })
        }
    }
    res
}
/// Encode partitions into a Replica Reponse
Encode partitions into a Replica Reponse
Encode partitions into a Replica Reponse
pub fn partition_metadata_to_replica_response(
    partitions: &PartitionLocalStore,
    topic: &String,
) -> Vec<FlvPartitionReplica> {
    let mut res: Vec<FlvPartitionReplica> = Vec::default();
    let partition_cnt = partitions.count_topic_partitions(topic);
    for idx in 0..partition_cnt {
        let name = ReplicaKey::new(topic.clone(), idx);
        if let Some(partition) = partitions.value(&name) {
            res.push(FlvPartitionReplica {
                id: idx,
                leader: partition.spec.leader,
                replicas: partition.spec.replicas.clone(),
                live_replicas: partition.status.live_replicas().clone(),
            })
        }
    }
    res
}
pub fn partition_metadata_to_replica_response ( partitions : & PartitionLocalStore , topic : & String , ) -> Vec < FlvPartitionReplica > { let mut res : Vec < FlvPartitionReplica > = Vec :: default ( ) ; let partition_cnt = partitions . count_topic_partitions ( topic ) ; for idx in 0 .. partition_cnt { let name = ReplicaKey :: new ( topic . clone ( ) , idx ) ; if let Some ( partition ) = partitions . value ( & name ) { res . push ( FlvPartitionReplica { id : idx , leader : partition . spec . leader , replicas : partition . spec . replicas . clone ( ) , live_replicas : partition . status . live_replicas ( ) . clone ( ) , } ) } } res }
Encode partitions into a Replica Reponse
Encode partitions into a Replica Reponse
partitions
&PartitionLocalStore
topic
&String
partitions
&PartitionLocalStore
topic
&String