/// Dispatch records based on the content of the record tuples variable
Dispatch records based on the content of the record tuples variable
Dispatch records based on the content of the record tuples variable
async fn render_produce_record<O: Terminal, L: ReplicaLeader>(
        out: std::sync::Arc<O>,
        mut leader: L,
        opt: ProduceLogConfig,
        record_tuples: RecordTuples,
    ) -> Result<(), CliError> {
        // in both cases, exit loop on error
        if record_tuples.len() > 0 {
            // records from files
            for r_tuple in record_tuples {
                t_println!(out, "{}", r_tuple.0);
                process_record(&mut leader, r_tuple.1).await;
            }
        } else {
            let stdin = stdin();
            let std_lock = stdin.lock().await;
            let mut lines = BufReader::new(std_lock).lines();
            while let Some(line) = lines.next().await {
                let text = line?;
                debug!("read lines {} bytes", text);
                let record = text.as_bytes().to_vec();
                process_record(&mut leader, record).await;
                if !opt.continuous {
                    return Ok(());
                }
            }
        }
        Ok(())
    }
async fn render_produce_record < O : Terminal , L : ReplicaLeader > ( out : std :: sync :: Arc < O > , mut leader : L , opt : ProduceLogConfig , record_tuples : RecordTuples , ) -> Result < ( ) , CliError > { // in both cases, exit loop on error if record_tuples . len ( ) > 0 { // records from files for r_tuple in record_tuples { t_println ! ( out " " r_tuple 0 ) ; process_record ( & mut leader , r_tuple . 1 ) . await ; } } else { let stdin = stdin ( ) ; let std_lock = stdin . lock ( ) . await ; let mut lines = BufReader :: new ( std_lock ) . lines ( ) ; while let Some ( line ) = lines . next ( ) . await { let text = line ? ; debug ! ( " " text ) ; let record = text . as_bytes ( ) . to_vec ( ) ; process_record ( & mut leader , record ) . await ; if ! opt . continuous { return Ok ( ( ) ) ; } } } Ok ( ( ) ) }
Dispatch records based on the content of the record tuples variable
Dispatch records based on the content of the record tuples variable
out
std::sync::Arc<O>
leader
L
opt
ProduceLogConfig
record_tuples
RecordTuples