func (f *SeriesFile) SeriesPartitionPath(i int) string {
	return filepath.Join(f.path, fmt.Sprintf("%02x", i))
}
SeriesPartitionPath returns the path to a given partition.
package tsdb
import (
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"sort"
	"sync"
	"github.com/cespare/xxhash"
	"github.com/influxdata/influxdb/models"
	"github.com/influxdata/influxdb/pkg/binaryutil"
	"go.uber.org/zap"
	"golang.org/x/sync/errgroup"
)
var (
	ErrSeriesFileClosed         = errors.New("tsdb: series file closed")
	ErrInvalidSeriesPartitionID = errors.New("tsdb: invalid series partition id")
)
const SeriesIDSize = 8
const (
	SeriesFilePartitionN = 8
)
type SeriesFile struct {
	path       string
	partitions []*SeriesPartition
	refs sync.RWMutex  
	Logger *zap.Logger
}
func NewSeriesFile(path string) *SeriesFile {
	return &SeriesFile{
		path:   path,
		Logger: zap.NewNop(),
	}
}
func (f *SeriesFile) Open() error {
	f.refs.Lock()
	defer f.refs.Unlock()
	if err := os.MkdirAll(filepath.Join(f.path), 0777); err != nil {
		return err
	}
	f.partitions = make([]*SeriesPartition, 0, SeriesFilePartitionN)
	for i := 0; i < SeriesFilePartitionN; i++ {
		p := NewSeriesPartition(i, f.SeriesPartitionPath(i))
		p.Logger = f.Logger.With(zap.Int("partition", p.ID()))
		if err := p.Open(); err != nil {
			f.Close()
			return err
		}
		f.partitions = append(f.partitions, p)
	}
	return nil
}
func (f *SeriesFile) Close() (err error) {
	f.refs.Lock()
	defer f.refs.Unlock()
	for _, p := range f.partitions {
		if e := p.Close(); e != nil && err == nil {
			err = e
		}
	}
	return err
}
func (f *SeriesFile) Path() string { return f.path }