From 34f3fd565efebc4679ceb99db787ab32f39350ba Mon Sep 17 00:00:00 2001 From: RemHero <1104304963@qq.com> Date: Thu, 18 Apr 2024 22:53:33 +0800 Subject: [PATCH] add OnMemChange in LockCtx Signed-off-by: RemHero <1104304963@qq.com> --- kv/kv.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kv/kv.go b/kv/kv.go index a7108cd07..ae67269cf 100644 --- a/kv/kv.go +++ b/kv/kv.go @@ -79,6 +79,7 @@ type LockCtx struct { // LockCtx specially. ResourceGroupTagger func(*kvrpcpb.PessimisticLockRequest) []byte OnDeadlock func(*tikverr.ErrDeadlock) + OnMemChange func(int) } // LockWaitTime returns lockWaitTimeInMs @@ -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))) +}