Skip to content

Commit

Permalink
add OnMemChange in LockCtx
Browse files Browse the repository at this point in the history
Signed-off-by: RemHero <[email protected]>
  • Loading branch information
RemHero committed Apr 18, 2024
1 parent 4183ab1 commit 34f3fd5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type LockCtx struct {
// LockCtx specially.
ResourceGroupTagger func(*kvrpcpb.PessimisticLockRequest) []byte
OnDeadlock func(*tikverr.ErrDeadlock)
OnMemChange func(int)
}

// LockWaitTime returns lockWaitTimeInMs
Expand Down Expand Up @@ -135,3 +136,13 @@ func (ctx *LockCtx) IterateValuesNotLocked(f func([]byte, []byte)) {
}
}
}

// getValuesKSize returns Values key size
func (ctx *LockCtx) GetValuesKSize() uint64 {
return uint64(unsafe.Sizeof(*new(string)))
}

// getValuesKSize returns Values value size
func (ctx *LockCtx) GetValuesVSize() uint64 {
return uint64(unsafe.Sizeof(*new(ReturnedValue)))
}

0 comments on commit 34f3fd5

Please sign in to comment.