Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Latches ¶
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 ¶
NewLatches create a Latches with fixed length, the size will be rounded up to the power of 2.
type LatchesScheduler ¶
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) RefreshCommitTS ¶
func (scheduler *LatchesScheduler) RefreshCommitTS(keys [][]byte, commitTS uint64)
RefreshCommitTS refreshes commitTS for keys. It could be used for the transaction not retryable, which would do 2PC directly and wouldn't get a lock.
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) SetCommitTS ¶
SetCommitTS sets the lock's commitTS.