resolver

package
v0.0.0-...-959c02d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(db *pebble.DB, batch *pebble.Batch, key kv.Key, startVer, commitVer kv.Version) error

Resolve resolves the specified key.

func Rollback

func Rollback(db *pebble.DB, batch *pebble.Batch, key kv.Key, startVer kv.Version) error

Types

type ErrAlreadyCommitted

type ErrAlreadyCommitted uint64

ErrAlreadyCommitted is returned specially when client tries to rollback a committed lock.

func (ErrAlreadyCommitted) Error

func (e ErrAlreadyCommitted) Error() string

type ErrRetryable

type ErrRetryable string

ErrRetryable suggests that client may restart the txn.

func (ErrRetryable) Error

func (e ErrRetryable) Error() string

type MultiKeysNotifier

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

func (*MultiKeysNotifier) Notify

func (s *MultiKeysNotifier) Notify(err error)

func (*MultiKeysNotifier) Wait

func (s *MultiKeysNotifier) Wait() []error

type Notifier

type Notifier interface {
	Notify(err error)
	Wait() []error
}

Notifier is used to notify the task finished.

func NewMultiKeysNotifier

func NewMultiKeysNotifier(size int) Notifier

type Scheduler

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

Scheduler is used to schedule Resolve tasks.

func NewScheduler

func NewScheduler(size int) *Scheduler

func (*Scheduler) Close

func (s *Scheduler) Close()

func (*Scheduler) Resolve

func (s *Scheduler) Resolve(keys []kv.Key, startVer, commitVer kv.Version, notifier Notifier)

Resolve submits a bundle of keys to resolve

func (*Scheduler) Run

func (s *Scheduler) Run()

Run initializes the resolvers and start to accept resolve tasks.

func (*Scheduler) SetDB

func (s *Scheduler) SetDB(db *pebble.DB)

type Task

type Task struct {
	Key       kv.Key
	StartVer  kv.Version
	CommitVer kv.Version
	Notifier  Notifier
}

Task represents a resolve task.

type TxnAction

type TxnAction byte
const (
	TxnActionNone TxnAction = iota
	TxnActionTTLExpireRollback
	TxnActionLockNotExistRollback
	TxnActionLockNotExistDoNothing
)

type TxnStatus

type TxnStatus struct {
	CommitVer kv.Version
	Action    TxnAction
}

func CheckTxnStatus

func CheckTxnStatus(db *pebble.DB, vp kv.VersionProvider, primaryKey kv.Key, startVer kv.Version) (TxnStatus, error)

CheckTxnStatus checks the transaction status according to the primary key.

Jump to

Keyboard shortcuts

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