aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-03-09 12:57:01 -0800
committerchrislu <chris.lu@gmail.com>2024-03-09 12:57:01 -0800
commitc1a5952009e58fb6524fa18b33ad1ab9e8794fd5 (patch)
tree37e48b70291a988197adae4cfb18188d2e72d0bd
parente7823ee967e0a199081605e156a84c785e9839b1 (diff)
downloadseaweedfs-c1a5952009e58fb6524fa18b33ad1ab9e8794fd5.tar.xz
seaweedfs-c1a5952009e58fb6524fa18b33ad1ab9e8794fd5.zip
rename
-rw-r--r--weed/cluster/lock_client.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/weed/cluster/lock_client.go b/weed/cluster/lock_client.go
index 4ebb067df..5b8daf1a7 100644
--- a/weed/cluster/lock_client.go
+++ b/weed/cluster/lock_client.go
@@ -31,9 +31,9 @@ func NewLockClient(grpcDialOption grpc.DialOption, seedFiler pb.ServerAddress) *
type LiveLock struct {
key string
renewToken string
- expireAtNs int64
- filer pb.ServerAddress
- cancelCh chan struct{}
+ expireAtNs int64
+ hostFiler pb.ServerAddress
+ cancelCh chan struct{}
grpcDialOption grpc.DialOption
isLocked bool
self string
@@ -45,7 +45,7 @@ type LiveLock struct {
func (lc *LockClient) NewShortLivedLock(key string, owner string) (lock *LiveLock) {
lock = &LiveLock{
key: key,
- filer: lc.seedFiler,
+ hostFiler: lc.seedFiler,
cancelCh: make(chan struct{}),
expireAtNs: time.Now().Add(5 * time.Second).UnixNano(),
grpcDialOption: lc.grpcDialOption,
@@ -60,7 +60,7 @@ func (lc *LockClient) NewShortLivedLock(key string, owner string) (lock *LiveLoc
func (lc *LockClient) StartLongLivedLock(key string, owner string, onLockOwnerChange func(newLockOwner string)) (lock *LiveLock) {
lock = &LiveLock{
key: key,
- filer: lc.seedFiler,
+ hostFiler: lc.seedFiler,
cancelCh: make(chan struct{}),
expireAtNs: time.Now().Add(lock_manager.LiveLockTTL).UnixNano(),
grpcDialOption: lc.grpcDialOption,
@@ -129,7 +129,7 @@ func (lock *LiveLock) StopShortLivedLock() error {
defer func() {
lock.isLocked = false
}()
- return pb.WithFilerClient(false, 0, lock.filer, lock.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
+ return pb.WithFilerClient(false, 0, lock.hostFiler, lock.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
_, err := client.DistributedUnlock(context.Background(), &filer_pb.UnlockRequest{
Name: lock.key,
RenewToken: lock.renewToken,
@@ -139,7 +139,7 @@ func (lock *LiveLock) StopShortLivedLock() error {
}
func (lock *LiveLock) doLock(lockDuration time.Duration) (errorMessage string, err error) {
- err = pb.WithFilerClient(false, 0, lock.filer, lock.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
+ err = pb.WithFilerClient(false, 0, lock.hostFiler, lock.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
resp, err := client.DistributedLock(context.Background(), &filer_pb.LockRequest{
Name: lock.key,
SecondsToLock: int64(lockDuration.Seconds()),
@@ -156,8 +156,8 @@ func (lock *LiveLock) doLock(lockDuration time.Duration) (errorMessage string, e
if resp != nil {
errorMessage = resp.Error
if resp.LockHostMovedTo != "" {
- lock.filer = pb.ServerAddress(resp.LockHostMovedTo)
- lock.lc.seedFiler = lock.filer
+ lock.hostFiler = pb.ServerAddress(resp.LockHostMovedTo)
+ lock.lc.seedFiler = lock.hostFiler
}
if resp.LockOwner != "" {
lock.owner = resp.LockOwner