code: func DeleteCheckpoints(dir string, maxIndex int) error {
  	var errs tsdb_errors.MultiError
  
  	files, err := ioutil.ReadDir(dir)
  	if err != nil {
  		return err
  	}
  	for _, fi := range files {
  		if !strings.HasPrefix(fi.Name(), checkpointPrefix) {
  			continue
  		}
  		index, err := strconv.Atoi(fi.Name()[len(checkpointPrefix):])
  		if err != nil || index >= maxIndex {
  			continue
  		}
  		if err := os.RemoveAll(filepath.Join(dir, fi.Name())); err != nil {
  			errs.Add(err)
  		}
  	}
  	return errs.Err()
  }
docs: // DeleteCheckpoints deletes all checkpoints in a directory below a given index.