rename variable

This commit is contained in:
chrislu 2022-08-30 00:07:15 -07:00
parent e16dda88e4
commit ae6292f9f0

View File

@ -18,19 +18,19 @@ import (
) )
type MasterClient struct { type MasterClient struct {
FilerGroup string FilerGroup string
clientType string clientType string
clientHost pb.ServerAddress clientHost pb.ServerAddress
rack string rack string
currentMaster pb.ServerAddress currentMaster pb.ServerAddress
masters map[string]pb.ServerAddress currentMasterLock sync.RWMutex
grpcDialOption grpc.DialOption masters map[string]pb.ServerAddress
grpcDialOption grpc.DialOption
vidMap vidMap
vidMapCacheSize int vidMapCacheSize int
OnPeerUpdate func(update *master_pb.ClusterNodeUpdate, startFrom time.Time) OnPeerUpdate func(update *master_pb.ClusterNodeUpdate, startFrom time.Time)
OnPeerUpdateLock sync.RWMutex OnPeerUpdateLock sync.RWMutex
accessLock sync.RWMutex
} }
func NewMasterClient(grpcDialOption grpc.DialOption, filerGroup string, clientType string, clientHost pb.ServerAddress, clientDataCenter string, rack string, masters map[string]pb.ServerAddress) *MasterClient { func NewMasterClient(grpcDialOption grpc.DialOption, filerGroup string, clientType string, clientHost pb.ServerAddress, clientDataCenter string, rack string, masters map[string]pb.ServerAddress) *MasterClient {
@ -92,15 +92,15 @@ func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []stri
} }
func (mc *MasterClient) getCurrentMaster() pb.ServerAddress { func (mc *MasterClient) getCurrentMaster() pb.ServerAddress {
mc.accessLock.RLock() mc.currentMasterLock.RLock()
defer mc.accessLock.RUnlock() defer mc.currentMasterLock.RUnlock()
return mc.currentMaster return mc.currentMaster
} }
func (mc *MasterClient) setCurrentMaster(master pb.ServerAddress) { func (mc *MasterClient) setCurrentMaster(master pb.ServerAddress) {
mc.accessLock.Lock() mc.currentMasterLock.Lock()
mc.currentMaster = master mc.currentMaster = master
mc.accessLock.Unlock() mc.currentMasterLock.Unlock()
} }
func (mc *MasterClient) GetMaster() pb.ServerAddress { func (mc *MasterClient) GetMaster() pb.ServerAddress {