code: func NewSegmentsRangeReader(sr ...SegmentRange) (io.ReadCloser, error) {
  	var segs []*Segment
  
  	for _, sgmRange := range sr {
  		refs, err := listSegments(sgmRange.Dir)
  		if err != nil {
  			return nil, errors.Wrapf(err, "list segment in dir:%v", sgmRange.Dir)
  		}
  
  		for _, r := range refs {
  			if sgmRange.First >= 0 && r.index < sgmRange.First {
  				continue
  			}
  			if sgmRange.Last >= 0 && r.index > sgmRange.Last {
  				break
  			}
  			s, err := OpenReadSegment(filepath.Join(sgmRange.Dir, r.name))
  			if err != nil {
  				return nil, errors.Wrapf(err, "open segment:%v in dir:%v", r.name, sgmRange.Dir)
  			}
  			segs = append(segs, s)
  		}
  	}
  	return newSegmentBufReader(segs...), nil
  }
docs: // NewSegmentsRangeReader returns a new reader over the given WAL segment ranges.
  // If first or last are -1, the range is open on the respective end.