Exemplo n.º 1
0
Arquivo: kv.go Projeto: 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),
	}
}
Exemplo n.º 2
0
Arquivo: kv.go Projeto: 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
}
Exemplo n.º 3
0
Arquivo: kv.go Projeto: 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
}