From 30e815c9145f857f66e39cdf53b6b089b6cde536 Mon Sep 17 00:00:00 2001 From: munakoiso Date: Tue, 27 Aug 2024 11:37:13 +0500 Subject: [PATCH] set acl in zk.set, zk.acquire_lock and zk.create functions --- .gitignore | 1 + internal/dcs/zk.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 40b5187..0e32eb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ cmd/rdsync/rdsync tests/logs/ +.idea diff --git a/internal/dcs/zk.go b/internal/dcs/zk.go index 5e34d96..9b54698 100644 --- a/internal/dcs/zk.go +++ b/internal/dcs/zk.go @@ -333,7 +333,7 @@ func (z *zkDCS) AcquireLock(path string) bool { if err != nil { panic(fmt.Sprintf("failed to serialize to JSON %#v", self)) } - _, err = z.retryCreate(fullPath, data, zk.FlagEphemeral, nil) + _, err = z.retryCreate(fullPath, data, zk.FlagEphemeral, z.acl) if err != nil { if err != zk.ErrNodeExists { z.logger.Error(fmt.Sprintf("Failed to acquire lock %s", fullPath), "error", err) @@ -383,7 +383,7 @@ func (z *zkDCS) create(path string, val interface{}, flags int32) error { if err != nil { return fmt.Errorf("failed to serialize to JSON %#v", val) } - _, err = z.retryCreate(fullPath, data, flags, nil) + _, err = z.retryCreate(fullPath, data, flags, z.acl) if err != nil { if err == zk.ErrNodeExists { return ErrExists @@ -418,7 +418,7 @@ func (z *zkDCS) set(path string, val interface{}, flags int32) error { if err != nil { return err } - _, err = z.retryCreate(fullPath, data, flags, nil) + _, err = z.retryCreate(fullPath, data, flags, z.acl) if err != nil { z.logger.Error(fmt.Sprintf("Failed to create node %s with %v", fullPath, val), "error", err) }