當前位置: 首頁>>代碼示例>>Golang>>正文


Golang kv.NewUnionStore函數代碼示例

本文整理匯總了Golang中github.com/pingcap/tidb/kv.NewUnionStore函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewUnionStore函數的具體用法?Golang NewUnionStore怎麽用?Golang NewUnionStore使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewUnionStore函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Begin

// Begin transaction
func (s *dbStore) Begin() (kv.Transaction, error) {
	s.mu.Lock()
	defer s.mu.Unlock()

	beginVer, err := globalVersionProvider.CurrentVersion()
	if err != nil {
		return nil, err
	}
	txn := &dbTxn{
		tid:          beginVer.Ver,
		valid:        true,
		store:        s,
		version:      kv.MinVersion,
		snapshotVals: make(map[string][]byte),
	}
	log.Debugf("Begin txn:%d", txn.tid)
	txn.UnionStore, err = kv.NewUnionStore(&dbSnapshot{
		db:      s.db,
		version: beginVer,
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return txn, nil
}
開發者ID:stumaxim28,項目名稱:tidb,代碼行數:26,代碼來源:kv.go

示例2: Begin

// Begin transaction
func (s *dbStore) Begin() (kv.Transaction, error) {
	providerMu.RLock()
	beginVer, err := globalVersionProvider.CurrentVersion()
	providerMu.RUnlock()
	if err != nil {
		return nil, errors.Trace(err)
	}

	s.mu.RLock()
	closed := s.closed
	s.mu.RUnlock()
	if closed {
		return nil, errors.Trace(ErrDBClosed)
	}

	txn := &dbTxn{
		tid:          beginVer.Ver,
		valid:        true,
		store:        s,
		version:      kv.MinVersion,
		snapshotVals: make(map[string]struct{}),
		opts:         make(map[kv.Option]interface{}),
	}
	log.Debugf("Begin txn:%d", txn.tid)
	txn.UnionStore = kv.NewUnionStore(newSnapshot(s, s.db, beginVer), options(txn.opts))
	return txn, nil
}
開發者ID:yzl11,項目名稱:vessel,代碼行數:28,代碼來源:kv.go

示例3: newHbaseTxn

func newHbaseTxn(t themis.Txn, storeName string) *hbaseTxn {
	return &hbaseTxn{
		txn:       t,
		valid:     true,
		storeName: storeName,
		tid:       t.GetStartTS(),
		us:        kv.NewUnionStore(newHbaseSnapshot(t, storeName)),
	}
}
開發者ID:astaxie,項目名稱:tidb,代碼行數:9,代碼來源:txn.go

示例4: Begin

func (s *hbaseStore) Begin() (kv.Transaction, error) {
	s.mu.Lock()
	defer s.mu.Unlock()
	hbaseCli := s.getHBaseClient()
	t := themis.NewTxn(hbaseCli)
	txn := newHbaseTxn(t, s.storeName)
	txn.UnionStore = kv.NewUnionStore(newHbaseSnapshot(t, s.storeName))
	return txn, nil
}
開發者ID:xwb1989,項目名稱:tidb,代碼行數:9,代碼來源:kv.go

示例5: newHbaseTxn

func newHbaseTxn(t *themis.Txn, storeName string) *hbaseTxn {
	opts := make(map[kv.Option]interface{})
	return &hbaseTxn{
		Txn:        t,
		valid:      true,
		storeName:  storeName,
		tid:        t.GetStartTS(),
		UnionStore: kv.NewUnionStore(newHbaseSnapshot(t, storeName), options(opts)),
		opts:       opts,
	}
}
開發者ID:BobbWu,項目名稱:tidb,代碼行數:11,代碼來源:txn.go

示例6: newTxn

func newTxn(s *dbStore, ver kv.Version) *dbTxn {
	txn := &dbTxn{
		us:         kv.NewUnionStore(newSnapshot(s, ver)),
		store:      s,
		tid:        ver.Ver,
		valid:      true,
		version:    kv.MinVersion,
		lockedKeys: make(map[string]struct{}),
	}
	log.Debugf("[kv] Begin txn:%d", txn.tid)
	return txn
}
開發者ID:lovedboy,項目名稱:tidb,代碼行數:12,代碼來源:txn.go

示例7: newTiKVTxn

func newTiKVTxn(store *tikvStore) (*tikvTxn, error) {
	startTS, err := store.getTimestampWithRetry()
	if err != nil {
		return nil, errors.Trace(err)
	}
	ver := kv.NewVersion(startTS)
	return &tikvTxn{
		us:      kv.NewUnionStore(newTiKVSnapshot(store, ver)),
		store:   store,
		startTS: startTS,
		valid:   true,
	}, nil
}
開發者ID:anywhy,項目名稱:tidb,代碼行數:13,代碼來源:txn.go

示例8: newTiKVTxn

func newTiKVTxn(store *tikvStore) (*tikvTxn, error) {
	bo := NewBackoffer(tsoMaxBackoff, context.Background())
	startTS, err := store.getTimestampWithRetry(bo)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ver := kv.NewVersion(startTS)
	return &tikvTxn{
		us:      kv.NewUnionStore(newTiKVSnapshot(store, ver)),
		store:   store,
		startTS: startTS,
		valid:   true,
	}, nil
}
開發者ID:pingcap,項目名稱:tidb,代碼行數:14,代碼來源:txn.go

示例9: Begin

// Begin transaction
func (s *dbStore) Begin() (kv.Transaction, error) {
	s.mu.Lock()
	defer s.mu.Unlock()

	snapshot, err := s.db.GetSnapshot()
	if err != nil {
		return nil, err
	}

	txn := &dbTxn{
		startTs:      time.Now(),
		tID:          atomic.AddInt64(&globalID, 1),
		valid:        true,
		store:        s,
		snapshotVals: make(map[string][]byte),
	}
	log.Debugf("Begin txn:%d", txn.tID)
	txn.UnionStore, err = kv.NewUnionStore(&dbSnapshot{snapshot})
	if err != nil {
		return nil, err
	}
	return txn, nil
}
開發者ID:ninefive,項目名稱:tidb,代碼行數:24,代碼來源:kv.go


注:本文中的github.com/pingcap/tidb/kv.NewUnionStore函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。