server: Add verification of whether lock was called within out outside of apply
This commit is contained in:
@ -53,6 +53,8 @@ type BatchTx interface {
|
||||
Commit()
|
||||
// CommitAndStop commits the previous tx and does not create a new one.
|
||||
CommitAndStop()
|
||||
LockInsideApply()
|
||||
LockOutsideApply()
|
||||
}
|
||||
|
||||
type batchTx struct {
|
||||
@ -67,6 +69,16 @@ func (t *batchTx) Lock() {
|
||||
t.Mutex.Lock()
|
||||
}
|
||||
|
||||
func (t *batchTx) LockInsideApply() {
|
||||
ValidateCalledInsideApply(t.backend.lg)
|
||||
t.Lock()
|
||||
}
|
||||
|
||||
func (t *batchTx) LockOutsideApply() {
|
||||
ValidateCalledOutSideApply(t.backend.lg)
|
||||
t.Lock()
|
||||
}
|
||||
|
||||
func (t *batchTx) Unlock() {
|
||||
if t.pending >= t.backend.batchLimit {
|
||||
t.commit(false)
|
||||
|
Reference in New Issue
Block a user