txn

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSnapshot

func NewSnapshot(snapshot *txnsnapshot.KVSnapshot) kv.Snapshot

NewSnapshot creates a kv.Snapshot with txnsnapshot.KVSnapshot.

func NewTiKVTxn

func NewTiKVTxn(txn *tikv.KVTxn) kv.Transaction

NewTiKVTxn returns a new Transaction.

Types

type BatchBufferGetter

type BatchBufferGetter interface {
	Len() int
	Getter
}

BatchBufferGetter is the interface for BatchGet.

type BatchGetter

type BatchGetter interface {
	// BatchGet gets a batch of values.
	BatchGet(ctx context.Context, keys []kv.Key) (map[string][]byte, error)
}

BatchGetter is the interface for BatchGet.

type BufferBatchGetter

type BufferBatchGetter struct {
	// contains filtered or unexported fields
}

BufferBatchGetter is the type for BatchGet with MemBuffer.

func NewBufferBatchGetter

func NewBufferBatchGetter(buffer BatchBufferGetter, middleCache Getter, snapshot BatchGetter) *BufferBatchGetter

NewBufferBatchGetter creates a new BufferBatchGetter.

func (*BufferBatchGetter) BatchGet

func (b *BufferBatchGetter) BatchGet(ctx context.Context, keys []kv.Key) (map[string][]byte, error)

BatchGet implements the BatchGetter interface.

type Getter

type Getter interface {
	// Get gets the value for key k from kv store.
	// If corresponding kv pair does not exist, it returns nil and ErrNotExist.
	Get(ctx context.Context, k kv.Key) ([]byte, error)
}

Getter is the interface for the Get method.

type TiDBKVFilter

type TiDBKVFilter struct{}

TiDBKVFilter is the filter specific to TiDB to filter out KV pairs that needn't be committed.

func (TiDBKVFilter) IsUnnecessaryKeyValue

func (f TiDBKVFilter) IsUnnecessaryKeyValue(key, value []byte, flags tikvstore.KeyFlags) (bool, error)

IsUnnecessaryKeyValue defines which kinds of KV pairs from TiDB needn't be committed.

type UnionIter

type UnionIter struct {
	// contains filtered or unexported fields
}

UnionIter implements kv.Iterator

func NewUnionIter

func NewUnionIter(dirtyIt kv.Iterator, snapshotIt kv.Iterator, reverse bool) (*UnionIter, error)

NewUnionIter returns a union iterator for BufferStore.

func (*UnionIter) Close

func (iter *UnionIter) Close()

Close implements the Iterator Close interface.

func (*UnionIter) Key

func (iter *UnionIter) Key() kv.Key

Key implements the Iterator Key interface.

func (*UnionIter) Next

func (iter *UnionIter) Next() error

Next implements the Iterator Next interface.

func (*UnionIter) Valid

func (iter *UnionIter) Valid() bool

Valid implements the Iterator Valid interface.

func (*UnionIter) Value

func (iter *UnionIter) Value() []byte

Value implements the Iterator Value interface. Multi columns

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL