code: func (rob *ReorderBuffer) Add(ts uint32, val float64) ([]schema.Point, error) {
  	ts = AggBoundary(ts, rob.interval)
  
  	// out of order and too old
  	if rob.buf[rob.newest].Ts != 0 && ts <= rob.buf[rob.newest].Ts-(uint32(cap(rob.buf))*rob.interval) {
  		return nil, errors.ErrMetricTooOld
  	}
  
  	var res []schema.Point
  	oldest := (rob.newest + 1) % uint32(cap(rob.buf))
  	index := (ts / rob.interval) % uint32(cap(rob.buf))
  	if ts == rob.buf[index].Ts {
  		return nil, errors.ErrMetricNewValueForTimestamp
  	} else if ts > rob.buf[rob.newest].Ts {
  		flushCount := (ts - rob.buf[rob.newest].Ts) / rob.interval
  		if flushCount > uint32(cap(rob.buf)) {
  			flushCount = uint32(cap(rob.buf))
  		}
  
  		for i := uint32(0); i < flushCount; i++ {
  			if rob.buf[oldest].Ts != 0 {
  				res = append(res, rob.buf[oldest])
  				rob.buf[oldest].Ts = 0
  			}
  			oldest = (oldest + 1) % uint32(cap(rob.buf))
  		}
  		rob.buf[index].Ts = ts
  		rob.buf[index].Val = val
  		rob.newest = index
  	} else {
  		metricsReordered.Inc()
  		rob.buf[index].Ts = ts
  		rob.buf[index].Val = val
  	}
  
  	return res, nil
  }
docs: // Add adds the point if it falls within the window.
  // it returns points that have been purged out of the buffer, as well as whether the add succeeded.