store

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityNormal = iota
	PriorityLow
	PriorityHigh
)

Priority value for transaction priority.

Variables

View Source
var MockAddr = "mocktikv://"

MockAddr default mock tikv addr

Functions

func BatchGetValues

func BatchGetValues(txn Transaction, keys [][]byte) (map[string][]byte, error)

BatchGetValues issue batch requests to get values

func DelOption added in v0.6.0

func DelOption(txn Transaction, opt Option)

func IsConflictError

func IsConflictError(err error) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

IsErrNotFound checks if err is a kind of NotFound error.

func IsRetryableError

func IsRetryableError(err error) bool

IsRetryableError checks if err is a kind of RetryableError error.

func LockKeys

func LockKeys(txn Transaction, keys [][]byte) error

LockKeys tries to lock the entries with the keys in KV store.

func RunInNewTxn

func RunInNewTxn(store Storage, retryable bool, f func(txn kv.Transaction) error) error

func SetOption added in v0.6.0

func SetOption(txn Transaction, opt Option, val interface{})

Types

type Iterator

type Iterator kv.Iterator

Iterator is the interface for a iterator on KV store.

type Option added in v0.6.0

type Option kv.Option

Option is used for customizing kv store's behaviors during a transaction.

const (
	// PresumeKeyNotExists indicates that when dealing with a Get operation but failing to read data from cache,
	// we presume that the key does not exist in Store. The actual existence will be checked before the
	// transaction's commit.
	// This option is an optimization for frequent checks during a transaction, e.g. batch inserts.
	PresumeKeyNotExists Option = iota + 1
	// PresumeKeyNotExistsError is the option key for error.
	// When PresumeKeyNotExists is set and condition is not match, should throw the error.
	PresumeKeyNotExistsError
	// BinlogInfo contains the binlog data and client.
	BinlogInfo
	// SchemaChecker is used for checking schema-validity.
	SchemaChecker
	// IsolationLevel sets isolation level for current transaction. The default level is SI.
	IsolationLevel
	// Priority marks the priority of this transaction.
	Priority
	// NotFillCache makes this request do not touch the LRU cache of the underlying storage.
	NotFillCache
	// SyncLog decides whether the WAL(write-ahead log) of this request should be synchronized.
	SyncLog
	// KeyOnly retrieve only keys, it can be used in scan now.
	KeyOnly
)

Transaction options

type Storage

type Storage kv.Storage

Storage defines the interface for storage.

func MockOpen

func MockOpen(addrs string) (r Storage, e error)

MockOpen create fake tikv db

func Open

func Open(addrs string) (r Storage, e error)

Open create tikv db ,create fake db if addr contains mockaddr

type Transaction

type Transaction kv.Transaction

Transaction defines the interface for operations inside a Transaction.

Jump to

Keyboard shortcuts

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