lock returns host and owner

This commit is contained in:
chrislu
2024-02-02 15:54:57 -08:00
parent d30150dde1
commit d41792461c
8 changed files with 254 additions and 245 deletions

View File

@@ -25,7 +25,7 @@ func NewDistributedLockManager(host pb.ServerAddress) *DistributedLockManager {
}
}
func (dlm *DistributedLockManager) LockWithTimeout(key string, expiredAtNs int64, token string, owner string) (renewToken string, movedTo pb.ServerAddress, err error) {
func (dlm *DistributedLockManager) LockWithTimeout(key string, expiredAtNs int64, token string, owner string) (lockOwner string, renewToken string, movedTo pb.ServerAddress, err error) {
movedTo, err = dlm.findLockOwningFiler(key)
if err != nil {
return
@@ -33,7 +33,7 @@ func (dlm *DistributedLockManager) LockWithTimeout(key string, expiredAtNs int64
if movedTo != dlm.Host {
return
}
renewToken, err = dlm.lockManager.Lock(key, expiredAtNs, token, owner)
lockOwner, renewToken, err = dlm.lockManager.Lock(key, expiredAtNs, token, owner)
return
}