tidb: github.com/pingcap/tidb/store/tikv/latch Index | Files

package latch

import "github.com/pingcap/tidb/store/tikv/latch"


Package Files

latch.go scheduler.go

type Latches Uses

type Latches struct {
    // contains filtered or unexported fields

Latches which are used for concurrency control. Each latch is indexed by a slot's ID, hence the term latch and slot are used in interchangeable, but conceptually a latch is a queue, and a slot is an index to the queue

func NewLatches Uses

func NewLatches(size uint) *Latches

NewLatches create a Latches with fixed length, the size will be rounded up to the power of 2.

type LatchesScheduler Uses

type LatchesScheduler struct {
    // contains filtered or unexported fields

LatchesScheduler is used to schedule latches for transactions.

func NewScheduler Uses

func NewScheduler(size uint) *LatchesScheduler

NewScheduler create the LatchesScheduler.

func (*LatchesScheduler) Close Uses

func (scheduler *LatchesScheduler) Close()

Close closes LatchesScheduler.

func (*LatchesScheduler) Lock Uses

func (scheduler *LatchesScheduler) Lock(startTS uint64, keys [][]byte) *Lock

Lock acquire the lock for transaction with startTS and keys. The caller goroutine would be blocked if the lock can't be obtained now. When this function returns, the lock state would be either success or stale(call lock.IsStale)

func (*LatchesScheduler) UnLock Uses

func (scheduler *LatchesScheduler) UnLock(lock *Lock)

UnLock unlocks a lock.

type Lock Uses

type Lock struct {
    // contains filtered or unexported fields

Lock is the locks' information required for a transaction.

func (*Lock) IsStale Uses

func (l *Lock) IsStale() bool

IsStale returns whether the status is stale.

func (*Lock) SetCommitTS Uses

func (l *Lock) SetCommitTS(commitTS uint64)

SetCommitTS sets the lock's commitTS.

Package latch imports 10 packages (graph) and is imported by 11 packages. Updated 2020-06-29. Refresh now. Tools for package owners.