mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-06 01:07:06 +08:00
raft cluster
wip: raft does not care about migrating wip: optimize code wip: raft election wip wip: fix raft leader missing log entries wip fix a dead lock batch set slot route wip: raft persist wip refactor cluster suite remove relay rename relay2 refactor: allow customizing client factory test raft refactor re-balance avoid errors caused by inconsistent status on follower nodes during raft commits test raft election
This commit is contained in:
@@ -159,7 +159,7 @@ func (dict *ConcurrentDict) PutIfExists(key string, val interface{}) (result int
|
||||
}
|
||||
|
||||
// Remove removes the key and return the number of deleted key-value
|
||||
func (dict *ConcurrentDict) Remove(key string) (result int) {
|
||||
func (dict *ConcurrentDict) Remove(key string) (val interface{}, result int) {
|
||||
if dict == nil {
|
||||
panic("dict is nil")
|
||||
}
|
||||
@@ -169,12 +169,12 @@ func (dict *ConcurrentDict) Remove(key string) (result int) {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
if _, ok := s.m[key]; ok {
|
||||
if val, ok := s.m[key]; ok {
|
||||
delete(s.m, key)
|
||||
dict.decreaseCount()
|
||||
return 1
|
||||
return val, 1
|
||||
}
|
||||
return 0
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
func (dict *ConcurrentDict) addCount() int32 {
|
||||
|
Reference in New Issue
Block a user