aboutsummaryrefslogtreecommitdiff
path: root/pkg/core/shards.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-12 15:00:16 +0200
committeralex <[email protected]>2026-07-12 15:00:16 +0200
commit6cb3313793bf45e197b3048f0abd2f600bf97bb5 (patch)
tree019a0995c7f9422ec9d739c77379ee7cc1a96b9c /pkg/core/shards.go
parentce9d9f8b2183bc0a31bfa40e780ae07182bc7cf8 (diff)
downloadredis-clone-multi/execute.tar.xz
redis-clone-multi/execute.zip
multi exec and discardmulti/execute
Diffstat (limited to 'pkg/core/shards.go')
-rw-r--r--pkg/core/shards.go11
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