code: func (w *SegmentWAL) LogSamples(samples []RefSample) error {
  	buf := w.getBuffer()
  
  	flag := w.encodeSamples(buf, samples)
  
  	w.mtx.Lock()
  	defer w.mtx.Unlock()
  
  	err := w.write(WALEntrySamples, flag, buf.Get())
  
  	w.putBuffer(buf)
  
  	if err != nil {
  		return errors.Wrap(err, "log series")
  	}
  	tf := w.head()
  
  	for _, s := range samples {
  		if tf.maxTime < s.T {
  			tf.maxTime = s.T
  		}
  	}
  	return nil
  }
docs: // LogSamples writes a batch of new samples to the log.