Documentation ¶
Index ¶
- func NewEtcdKVBase(client *clientv3.Client, rootPath string) *etcdKVBase
- func NewSlowLogTxn(client *clientv3.Client) clientv3.Txn
- type Base
- type LevelDBKV
- func (kv *LevelDBKV) Load(key string) (string, error)
- func (kv *LevelDBKV) LoadRange(startKey, endKey string, limit int) ([]string, []string, error)
- func (kv *LevelDBKV) Remove(key string) error
- func (kv *LevelDBKV) RunInTxn(ctx context.Context, f func(txn Txn) error) error
- func (kv *LevelDBKV) Save(key, value string) error
- type SlowLogTxn
- type Txn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEtcdKVBase ¶
NewEtcdKVBase creates a new etcd kv.
Types ¶
type Base ¶
type Base interface { Txn // RunInTxn runs the user provided function in a Transaction. // If user provided function f returns a non-nil error, then // transaction will not be committed, the same error will be // returned by RunInTxn. // Otherwise, it returns the error occurred during the // transaction. // Note that transaction are not committed until RunInTxn returns nil. // Note: // 1. Load and LoadRange operations provides only stale read. // Values saved/ removed during transaction will not be immediately // observable in the same transaction. // 2. Only when storage is etcd, does RunInTxn checks that // values loaded during transaction has not been modified before commit. RunInTxn(ctx context.Context, f func(txn Txn) error) error }
Base is an abstract interface for load/save pd cluster data.
type LevelDBKV ¶
LevelDBKV is a kv store using LevelDB.
func NewLevelDBKV ¶
NewLevelDBKV is used to store regions information.
type SlowLogTxn ¶
SlowLogTxn wraps etcd transaction and log slow one.
func (*SlowLogTxn) Commit ¶
func (t *SlowLogTxn) Commit() (*clientv3.TxnResponse, error)
Commit implements Txn Commit interface.
type Txn ¶
type Txn interface { Save(key, value string) error Remove(key string) error Load(key string) (string, error) LoadRange(key, endKey string, limit int) (keys []string, values []string, err error) }
Txn bundles multiple operations into a single executable unit. It enables kv to atomically apply a set of updates.
Click to show internal directories.
Click to hide internal directories.