pub fn write_lp(&mut self, lines: &str) -> Result<()> {
        for (line_idx, maybe_line) in parse_lines(lines).enumerate() {
            let mut line = maybe_line.context(LineProtocolSnafu { line: line_idx + 1 })?;

            if let Some(t) = line.timestamp.as_mut() {
                *t = t
                    .checked_mul(self.timestamp_base)
                    .ok_or(Error::TimestampOverflow)?;
            }

            self.stats.num_lines += 1;
            self.stats.num_fields += line.field_set.len();

            let measurement = line.series.measurement.as_str();

            let (_, batch) = self
                .batches
                .raw_entry_mut()
                .from_key(measurement)
                .or_insert_with(|| (measurement.to_string(), MutableBatch::new()));

            // TODO: Reuse writer
            let mut writer = Writer::new(batch, 1);
            write_line(&mut writer, &line, self.default_time)
                .context(WriteSnafu { line: line_idx + 1 })?;
            writer.commit();
        }
        Ok(())
    }
/// Write some line protocol data.
///
/// If a field / tag name appears more than once in a single line, the
/// following semantics apply:
///
///   * duplicate fields, same value: do nothing/coalesce
///   * duplicate fields, different value: last occurrence wins
///   * duplicate fields, different types: return
///     [`LineWriteError::ConflictedFieldTypes`]
///   * duplicate tags, same value: return [`LineWriteError::DuplicateTag`]
///   * duplicate tags, different value: return
///     [`LineWriteError::DuplicateTag`]
///   * duplicate tags, different types: return
///     [`LineWriteError::DuplicateTag`]
///   * same name for tag and field: return
///     [`mutable_batch::writer::Error::TypeMismatch`]
///   * same name for tag and field, different type :
///     [`mutable_batch::writer::Error::TypeMismatch`]
///
Write some line protocol data.
If a field / tag name appears more than once in a single line, the
following semantics apply.


Write some line protocol data . If a field / tag name appears more than once in a single line the following semantics apply .
pub fn write_lp(&mut self, lines: &str) -> Result<()> {
        for (line_idx, maybe_line) in parse_lines(lines).enumerate() {
            let mut line = maybe_line.context(LineProtocolSnafu { line: line_idx + 1 })?;
            if let Some(t) = line.timestamp.as_mut() {
                *t = t
                    .checked_mul(self.timestamp_base)
                    .ok_or(Error::TimestampOverflow)?;
            }
            self.stats.num_lines += 1;
            self.stats.num_fields += line.field_set.len();
            let measurement = line.series.measurement.as_str();
            let (_, batch) = self
                .batches
                .raw_entry_mut()
                .from_key(measurement)
                .or_insert_with(|| (measurement.to_string(), MutableBatch::new()));
            // TODO: Reuse writer
            let mut writer = Writer::new(batch, 1);
            write_line(&mut writer, &line, self.default_time)
                .context(WriteSnafu { line: line_idx + 1 })?;
            writer.commit();
        }
        Ok(())
    }
pub fn write_lp ( & mut self , lines : & str ) -> Result < ( ) > { for ( line_idx , maybe_line ) in parse_lines ( lines ) . enumerate ( ) { let mut line = maybe_line . context ( LineProtocolSnafu { line : line_idx + 1 } ) ? ; if let Some ( t ) = line . timestamp . as_mut ( ) { * t = t . checked_mul ( self . timestamp_base ) . ok_or ( Error :: TimestampOverflow ) ? ; } self . stats . num_lines += 1 ; self . stats . num_fields += line . field_set . len ( ) ; let measurement = line . series . measurement . as_str ( ) ; let ( _ , batch ) = self . batches . raw_entry_mut ( ) . from_key ( measurement ) . or_insert_with ( | | ( measurement . to_string ( ) , MutableBatch :: new ( ) ) ) ; // TODO: Reuse writer let mut writer = Writer :: new ( batch , 1 ) ; write_line ( & mut writer , & line , self . default_time ) . context ( WriteSnafu { line : line_idx + 1 } ) ? ; writer . commit ( ) ; } Ok ( ( ) ) }
Write some line protocol data.
Write some line protocol data .
&mut self
lines
&str
&mut self
lines
&str