Documentation ¶
Overview ¶
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
package sdk defined spanner sdk for tikv transaction
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrRegionError = errors.New("region error") )
Functions ¶
This section is empty.
Types ¶
type KeyStore ¶
KeyStore store all keys locally TODO should be an interface
func (*KeyStore) GetAllOperations ¶
GetAllOperations return all k-v pairs store in kvstore in operation set
type Pacemaker ¶
Pacemaker sent heartbeat to every perticapate nodes
func NewPacemaker ¶
NewPacemaker gen a pacemaker client with context, txnid
func (*Pacemaker) AddNode ¶
func (p *Pacemaker) AddNode(rid uint64, cli TiKVClient)
AddNode add new node
func (*Pacemaker) AllNodes ¶
func (p *Pacemaker) AllNodes() ([]TiKVClient, []uint64)
AllNodes return all stored kv client
func (*Pacemaker) ChooseLeader ¶
func (p *Pacemaker) ChooseLeader() (TiKVClient, uint64)
ChooseLeader return all stored kv client
type TiKVClient ¶
type TiKVClient interface { Get(ctx context.Context, txnID uint64, key []byte, version uint64, readOnly bool) ([]byte, error) Commit(ctx context.Context, txnID uint64, operations []Operation, coordinatorId uint64, participants []uint64) (uint64, error) HeartBeat(ctx context.Context, txnID uint64, ttl uint64) error Close() error }
func NewTiKV ¶
func NewTiKV(address string) (TiKVClient, error)
type Transaction ¶
type Transaction interface { Get(key []byte) ([]byte, error) Set(key []byte, value []byte) error Delete(key []byte) error Rollback() error Commit() error Close() error }
Transaction defiend spanner transaction interface, implemented by ro transaction and rw transaction