Documentation ¶
Index ¶
- type Client
- type Transaction
- func (txn *Transaction) BatchGet(keys []key.Key) (map[string][]byte, error)
- func (txn *Transaction) Commit(ctx context.Context) error
- func (txn *Transaction) DelOption(opt kv.Option)
- func (txn *Transaction) Delete(k key.Key) error
- func (txn *Transaction) Get(k key.Key) ([]byte, error)
- func (txn *Transaction) IsReadOnly() bool
- func (txn *Transaction) Iter(k key.Key, upperBound key.Key) (kv.Iterator, error)
- func (txn *Transaction) IterReverse(k key.Key) (kv.Iterator, error)
- func (txn *Transaction) Len() int
- func (txn *Transaction) LockKeys(keys ...key.Key) error
- func (txn *Transaction) Rollback() error
- func (txn *Transaction) Set(k key.Key, v []byte) error
- func (txn *Transaction) SetOption(opt kv.Option, val interface{})
- func (txn *Transaction) Size() int
- func (txn *Transaction) String() string
- func (txn *Transaction) Valid() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a transactional client of TiKV server.
func (*Client) Begin ¶
func (c *Client) Begin() (*Transaction, error)
Begin creates a transaction for read/write.
func (*Client) BeginWithTS ¶
func (c *Client) BeginWithTS(ts uint64) *Transaction
BeginWithTS creates a transaction which is normally readonly.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a key-value transaction.
func (*Transaction) Commit ¶
func (txn *Transaction) Commit(ctx context.Context) error
Commit commits the transaction operations to KV store.
func (*Transaction) DelOption ¶
func (txn *Transaction) DelOption(opt kv.Option)
DelOption deletes an option.
func (*Transaction) Delete ¶
func (txn *Transaction) Delete(k key.Key) error
Delete removes the entry for key k from kv store.
func (*Transaction) Get ¶
func (txn *Transaction) Get(k key.Key) ([]byte, error)
Get implements transaction interface.
func (*Transaction) IsReadOnly ¶
func (txn *Transaction) IsReadOnly() bool
IsReadOnly returns if there are pending key-value to commit in the transaction.
func (*Transaction) Iter ¶
Iter creates an Iterator positioned on the first entry that k <= entry's key. If such entry is not found, it returns an invalid Iterator with no error. It yields only keys that < upperBound. If upperBound is nil, it means the upperBound is unbounded. The Iterator must be closed after use.
func (*Transaction) IterReverse ¶
IterReverse creates a reversed Iterator positioned on the first entry which key is less than k.
func (*Transaction) Len ¶
func (txn *Transaction) Len() int
Len returns the count of key-value pairs in the transaction's memory buffer.
func (*Transaction) LockKeys ¶
func (txn *Transaction) LockKeys(keys ...key.Key) error
LockKeys tries to lock the entries with the keys in KV store.
func (*Transaction) Rollback ¶
func (txn *Transaction) Rollback() error
Rollback undoes the transaction operations to KV store.
func (*Transaction) Set ¶
func (txn *Transaction) Set(k key.Key, v []byte) error
Set sets the value for key k as v into kv store.
func (*Transaction) SetOption ¶
func (txn *Transaction) SetOption(opt kv.Option, val interface{})
SetOption sets an option with a value, when val is nil, uses the default value of this option.
func (*Transaction) Size ¶
func (txn *Transaction) Size() int
Size returns the length (in bytes) of the transaction's memory buffer.
func (*Transaction) String ¶
func (txn *Transaction) String() string
func (*Transaction) Valid ¶
func (txn *Transaction) Valid() bool
Valid returns if the transaction is valid. A transaction becomes invalid after commit or rollback.