latch

package
v0.0.0-...-d60a1a2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Latches

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

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

type LatchesScheduler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LatchesScheduler is used to schedule latches for transactions.

func NewScheduler

func NewScheduler(size uint) *LatchesScheduler

NewScheduler create the LatchesScheduler.

func (*LatchesScheduler) Close

func (scheduler *LatchesScheduler) Close()

Close closes LatchesScheduler.

func (*LatchesScheduler) Lock

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

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

UnLock unlocks a lock.

type Lock

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

Lock is the locks' information required for a transaction.

func (*Lock) IsStale

func (l *Lock) IsStale() bool

IsStale returns whether the status is stale.

func (*Lock) SetCommitTS

func (l *Lock) SetCommitTS(commitTS uint64)

SetCommitTS sets the lock's commitTS.

Jump to

Keyboard shortcuts

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