AddUnchangedKeyForLock adds an unchanged key for pessimistic lock.
(key []byte, shared bool)
| 323 | |
| 324 | // AddUnchangedKeyForLock adds an unchanged key for pessimistic lock. |
| 325 | func (tc *TransactionContext) AddUnchangedKeyForLock(key []byte, shared bool) { |
| 326 | if tc.unchangedKeys == nil { |
| 327 | tc.unchangedKeys = map[string]bool{} |
| 328 | } |
| 329 | k := string(key) |
| 330 | alreadyShared, exist := tc.unchangedKeys[k] |
| 331 | tc.unchangedKeys[k] = shared && (!exist || (exist && alreadyShared)) |
| 332 | } |
| 333 | |
| 334 | // CollectUnchangedKeysForXLock collects unchanged keys for pessimistic lock. |
| 335 | func (tc *TransactionContext) CollectUnchangedKeysForXLock(buf []kv.Key) []kv.Key { |
no outgoing calls
no test coverage detected