예제 #1
0
파일: kv.go 프로젝트: yubobo/tidb
func newTikvStore(uuid string, pdClient pd.Client, client Client) *tikvStore {
	return &tikvStore{
		uuid:        uuid,
		oracle:      oracles.NewPdOracle(pdClient),
		client:      client,
		regionCache: NewRegionCache(pdClient),
	}
}
예제 #2
0
파일: kv.go 프로젝트: XuHuaiyu/tidb
func newTikvStore(uuid string, pdClient pd.Client, client Client) (*tikvStore, error) {
	oracle, err := oracles.NewPdOracle(pdClient, time.Duration(oracleUpdateInterval)*time.Millisecond)
	if err != nil {
		return nil, errors.Trace(err)
	}

	store := &tikvStore{
		uuid:        uuid,
		oracle:      oracle,
		client:      client,
		regionCache: NewRegionCache(pdClient),
	}
	store.lockResolver = NewLockResolver(store)
	return store, nil
}
예제 #3
0
파일: kv.go 프로젝트: pingcap/tidb
func newTikvStore(uuid string, pdClient pd.Client, client Client, enableGC bool) (*tikvStore, error) {
	oracle, err := oracles.NewPdOracle(pdClient, time.Duration(oracleUpdateInterval)*time.Millisecond)
	if err != nil {
		return nil, errors.Trace(err)
	}

	store := &tikvStore{
		clusterID:   pdClient.GetClusterID(),
		uuid:        uuid,
		oracle:      oracle,
		client:      client,
		regionCache: NewRegionCache(pdClient),
	}
	store.lockResolver = newLockResolver(store)
	if enableGC {
		store.gcWorker, err = NewGCWorker(store)
		if err != nil {
			return nil, errors.Trace(err)
		}
	}
	return store, nil
}