本文整理汇总了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
}
示例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
}
示例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)),
}
}
示例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
}
示例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,
}
}
示例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
}
示例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
}
示例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
}
示例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
}