diff options
Diffstat (limited to 'pkg/core/shards.go')
| -rw-r--r-- | pkg/core/shards.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/core/shards.go b/pkg/core/shards.go index 5ede61c..1732be5 100644 --- a/pkg/core/shards.go +++ b/pkg/core/shards.go @@ -131,4 +131,15 @@ func ( db *RedisDB) Unlock(keys []string){ for i := len(sortedIDs)-1; i >= 0; i --{ shardMap[sortedIDs[i]].Mu.Unlock() } +} + +func (db *RedisDB)LockAll(){ + for _, shard := range db.Shards { + shard.Mu.Lock() + } +} +func (db *RedisDB)UnlockAll(){ + for i := len(db.Shards)-1;i >= 0; i --{ + db.Shards[i].Mu.Unlock() + } }
\ No newline at end of file |
